How to pass the gridview datakey to filter a dataset, help pleas
-
HI, i am have this grid view, and i have a ds binding a repeater. i want to filter the select command depending on the seleccion in the gridview, i have this code, but i can't make work right.
Sub BindData() 'Read sample item info from XML document into a DataSet Dim cnn As SqlConnection = New SqlConnection(ConfigurationManager.ConnectionStrings("vpx_newConnectionString").ToString) cnn.Open() Dim cmd As SqlDataAdapter = New SqlDataAdapter("select * from mediaphotos Where EventID =" & GridView1.SelectedValue, cnn) Dim ds As New DataSet() cmd.Fill(ds) ' Populate the repeater control with the Items DataSet Dim dsPaged As New PagedDataSource() dsPaged.DataSource = ds.Tables(0).DefaultView dsPaged.AllowPaging = True dsPaged.PageSize = 5 dsPaged.CurrentPageIndex = CurrentPage 'Disable Prev or Next buttons if necessary cmdPrev.Enabled = Not dsPaged.IsFirstPage cmdNext.Enabled = Not dsPaged.IsLastPage rptParts.DataSource = dsPaged rptParts.DataBind()
can someone help me here, what i am doing wrong