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! imagebutton 在 gridview datalist repeater 回发或回调参数无效。

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 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-10-03
  • 2021-05-25
  • 2021-07-31
  • 2022-01-26
相关资源
相似解决方案