【发布时间】:2017-04-07 15:23:02
【问题描述】:
我使用了asp:GridView 与ClientIDMode="Static" 和ID="GridView2",它显示了一些特定的结果,比如单击按钮时的帐户详细信息。
首先我对网格进行数据绑定,除了回发延迟和整个页面重绘之外,其他一切都很好。
(GridView2.DataSource = datatable.DefaultView;
GridView2.DataBind();)
现在我正在使用 Ajax 来更新这个网格(我在 Ajax 函数中创建网格的 html 并像这样在 Grid html 上覆盖它
$('#GridView2').html(html.join(''))
),它正在正确绘制,但现在我无法在服务器端访问它的行。
for (int rows = 0; rows < mayDataGrid.Rows.Count; rows++)//.Rows.Count is always 0 but in html it is there.
【问题讨论】:
-
你应该将 GridView 包裹在 UpdatePanel 中以 ajaxify 网格而不是手动在 dom 元素中注入 html
标签: asp.net