Hi I have a datagrid which contains a dropdownlist in the . I have crated an OnSelectedIndexChanged function for this dropdownlist. My problem is that I need is to get access to the DataKeyField value of the row in which the changed dropdownlist is contained.
Any suggestion is welcome...
0
1
2
3
***************************************************
Sub ddlRating_RatingChanged(sender As Object, e As EventArgs)
//need to get the DataKeyField value of the row containing the modified ddl.
End Sub
0
1
2
3
4
5
Not Rated
***********************************
Sub ddlRating_RatingChanged(ByVal sender As Object, ByVal e As EventArgs)
Dim i
Dim lbl_RatingId As Label
For i = 0 To dgRatings.Items.Count() - 1
If dgRatings.Items(i).Cells(3).Controls(1).UniqueID().ToString = sender.UniqueID().ToString() Then
lbl_RatingId = CType(dgRatings.Items(i).Cells(0).Controls(1), Label)
Exit For
End If
Next
Response.Write(lbl_RatingId.Text)
End Sub
Ed@Golder
Member
10 Points
2 Posts
Datagrid event question
Sep 03, 2003 01:13 PM|LINK
Ed@Golder
Member
10 Points
2 Posts
Re: Datagrid event question
Sep 03, 2003 09:01 PM|LINK
0 1 2 3 4 5 Not Rated *********************************** Sub ddlRating_RatingChanged(ByVal sender As Object, ByVal e As EventArgs) Dim i Dim lbl_RatingId As Label For i = 0 To dgRatings.Items.Count() - 1 If dgRatings.Items(i).Cells(3).Controls(1).UniqueID().ToString = sender.UniqueID().ToString() Then lbl_RatingId = CType(dgRatings.Items(i).Cells(0).Controls(1), Label) Exit For End If Next Response.Write(lbl_RatingId.Text) End SubYeah Baby!