Imports System.Data

Imports System.Data.OleDb

Imports System.Configuration

Imports System.Collections

Imports System.Web

Imports System.Web.Security

Imports System.Web.UI

Imports System.Web.UI.WebControls

Imports System.Web.UI.WebControls.WebParts

Imports System.Web.UI.HtmlControls

Imports System.IO

Partial Class _Default

Inherits System.Web.UI.Page

Dim sql As String = String.Empty, dbread

Dim sql1 As String

Dim dbconn = New Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;data source=" & Server.MapPath("Aliyah.mdb"))

Dim dbcomm As New Data.OleDb.OleDbCommand

Dim dbcomm1 As New Data.OleDb.OleDbCommand

Dim dbcomm2 As New Data.OleDb.OleDbCommand

Dim comm As New Data.OleDb.OleDbCommand

Dim cmd As New Data.OleDb.OleDbCommand

Protected Sub GridView1_RowCancelingEdit(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCancelEditEventArgs) Handles GridView1.RowCancelingEdit

GridView1.EditIndex = -1

bindgrid()

End Sub

Protected Sub GridView1_RowEditing(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles GridView1.RowEditing

GridView1.EditIndex = e.NewEditIndex

bindgrid()

End Sub

Protected Sub GridView1_RowUpdated(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdatedEventArgs) Handles GridView1.RowUpdated

GridView1.EditIndex = -1

bindgrid()

End Sub

Protected Sub GridView1_RowUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles GridView1.RowUpdating

Dim t4 As String = GridView1.DataKeys(e.RowIndex).Value.ToString()

Dim sname As TextBox = TryCast(GridView1.Rows(e.RowIndex).FindControl("TextBox1"), TextBox)

Dim simage As FileUpload = TryCast(GridView1.Rows(e.RowIndex).FindControl("FileUpload2"), FileUpload)

Dim query As String = "update aliya set title=@sname,photo=@simage where slno=@t4"

Dim fileExt As String = Path.GetExtension(simage.FileName)

simage.SaveAs(MapPath("~/UploadImages/" + simage.FileName))

Dim imgName1 As String = simage.FileName

Dim imgPath1 As String = "UploadImages/" & imgName1

Dim text1 As String

text1 = imgPath1

Dim cmd As New OleDbCommand(query, dbconn)

cmd.Parameters.Add("@title", OleDbType.VarChar).Value = sname.Text

cmd.Parameters.Add("@photo", OleDbType.VarChar).Value = text1

cmd.Parameters.Add("@slno", OleDbType.Integer).Value = t4

cmd.CommandType = CommandType.Text

cmd.ExecuteNonQuery()

End Sub

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

dbconn.open()

bindgrid()

End Sub

Private Sub bindgrid()

If Not IsPostBack = True Then

sql = "SELECT slno,PHOTO,TITLE,DESCRIPTION,rating FROM Aliya where category='" & DDLCategory.Text & "'"

Dim ds As DataSet

dbcomm = New OleDbCommand(sql, dbconn)

Dim da As OleDbDataAdapter

ds = New DataSet()

da = New OleDbDataAdapter(dbcomm)

da.Fill(ds, sql)

GridView1.DataSource = ds

GridView1.DataBind()

End If

End Sub

Protected Sub btndelete_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btndelete.Click

Dim idCollection As New StringCollection()

Dim strID As String

For i As Integer = 0 To GridView1.Rows.Count - 1

Dim chkDelete As CheckBox = DirectCast(GridView1.Rows(i).Cells(1).FindControl("CheckBox1"), CheckBox)

Dim t1 As Label = DirectCast(GridView1.Rows(i).Cells(2).FindControl("Label1"), Label)

If chkDelete IsNot Nothing Then

If chkDelete.Checked Then

strID = t1.Text

idCollection.Add(strID)

End If

End If

Next

DeleteMultipleRecords(idCollection)

End Sub

Private Sub DeleteMultipleRecords(ByVal idCollection As StringCollection)

Dim IDs As String = ""

For Each id As String In idCollection

IDs += id.ToString() & ","

Next

Dim strIDs As String = IDs.Substring(0, IDs.LastIndexOf(","))

Dim strSql As String = "Delete from Aliya WHERE SLNO in (" & strIDs & ")"

cmd.CommandType = CommandType.Text

cmd.CommandText = strSql

cmd.Connection = dbconn

cmd.ExecuteNonQuery()

End Sub

Protected Sub DDLCategory_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DDLCategory.SelectedIndexChanged

sql = "SELECT slno,PHOTO,TITLE,DESCRIPTION,rating FROM Aliya where category='" & DDLCategory.Text & "'"

Dim ds As DataSet

dbcomm = New OleDbCommand(sql, dbconn)

Dim da As OleDbDataAdapter

ds = New DataSet()

da = New OleDbDataAdapter(dbcomm)

da.Fill(ds, sql)

GridView1.DataSource = ds

GridView1.DataBind()

End Sub

End Class

EditItemTemplate

asp:DropDownList ID="DDLRating" runat="server" DataSourceID="AccessDataSource1"

EnableViewState="false" DataTextField="RATING" DataValueField="RATING"

</asp:DropDownList

asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="~/ALIYAH.mdb"

SelectCommand="SELECT distinct [RATING] FROM [ALIYA]"</asp:AccessDataSource

</EditItemTemplate

Journals – IMGAE

Publications – WORD PDF UPLOAD

Audio/Video

Discussion fORUM