涉及 Webgrid 的 Ajax 帮助
我对 Ajax 没有经验。我正在使用一个执行以下操作的网络网格:
javascript:__doPostBack('GridView1','Select$1')
当选择一行时。发布此信息后如何调用某些操作?
____更新____ ___
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.DataItemIndex == -1)
return;
e.Row.Attributes.Add("onMouseOver",
"this.style.cursor='hand';");
e.Row.Attributes.Add("onclick",
GetPostBackClientEvent(GridView1,
"Select$" + e.Row.RowIndex.ToString())
);
}
I'm unexperienced with Ajax. I'm using a webgrid that executes:
javascript:__doPostBack('GridView1','Select$1')
when a row is selected. How can I call some action when this is posted?
____UPDATE_______
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.DataItemIndex == -1)
return;
e.Row.Attributes.Add("onMouseOver",
"this.style.cursor='hand';");
e.Row.Attributes.Add("onclick",
GetPostBackClientEvent(GridView1,
"Select$" + e.Row.RowIndex.ToString())
);
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您编写的代码不是 Ajax(除非网格包含在更新面板或类似的东西中)。
在服务器端触发事件的方式如下:
UPDATE
重要的是我的代码中的“参数”部分,因为它将包含该人以
Select$
形式单击的行,我想您需要做一些事情有了这些信息。
The code you wrote is not Ajax (unless the grid is enclosed in an update panel or something like that).
The way you trigger an event on the server side would be like this:
UPDATE
The important thing is going to be the "argument" piece in my code since it will have the row that the person clicked on in the form of
Select$<RowNumber>
I guess you need to do something with that information.