Now, I have a nested gridview to display these info. The outer gridview has all the data under file properties table. The inner gridview has the file paths that would be binded to the MD5 of the outer gridview. What I want is for each row, it would show all the properties of the file and its registered file paths.
Now my problem is, it shows all the file properties but for the inner gridview, it shows all the file paths for all files on the db. I'm not sure why its not binding to the outer gridview's MD5 so that the file paths that would be displayed should be for the particular MD5 of a row.
Here's what I got in my RowDataBound:
Private Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
Dim gv As GridView = DirectCast(e.Row.FindControl("gridview3"), GridView)
Dim conn As New SqlConnection
Dim myCommand As New SqlCommand
Dim myAdapter As New SqlDataAdapter
Dim myData As New DataSet
Dim SQL As String
Dim myconn As String
SQL = "SELECT filepath from tb_filepath WHERE md5='" & DirectCast(e.Row.DataItem, DataRowView)("md5").ToString & "'"
myconn = "server=tmcm;database=db_Files;Trusted_Connection=True"
conn.ConnectionString = myconn
conn.Open()
myCommand.Connection = conn
myCommand.CommandText = SQL
myCommand.ExecuteNonQuery()
gv.AutoGenerateColumns = False
gv.DataBind()
End If
End Sub
Sorry for being a noob...Still new in asp.net...if you could suggest another approach, i'm open for that. hope you could help me. thanks
This post has been edited by jpcsmit: 03 November 2009 - 03:14 PM

New Topic/Question
Reply




MultiQuote




|