imagebutton 在 gridview datalist repeater 回发或回调参数无效。
Hi Paula,
You can assign the ID for each row in the GridView via the sample code below. The code belows will give each row a unique ID from a global variable.
Dim intGRID as Integer = 1 'Global declaration
Protected Sub SampleGridView_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles SampleGridView.RowDataBound
e.Row.ID = "sampleGridRow_" & Cstr(intGRID)
intGRID += 1 'Increase intGRID by one
End Sub
Hope this helps.
Hi all!
emptycan, thank you very much! Your solution is excellent!
![Yes](http://forums.asp.net/emoticons/emotion-21.gif)
If you don't want use additional variables, you can do this:
protected void SomeGridView_RowDataBound(object sender, GridViewRowEventArgs e)
{
e.Row.ID = Guid.NewGuid().ToString();}
Henk, not quite. The Guid would be different for each postback, recreating the original problem. Emptycan's solution works because his code will recreate the exact same IDs on each postback.
-Jason