gpt4 book ai didi

javascript - 涉及 Webgrid 的 Ajax 帮助

转载 作者:行者123 更新时间:2023-12-02 20:05:20 25 4
gpt4 key购买 nike

我对 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())
);
}

最佳答案

您编写的代码不是 Ajax(除非网格包含在更新面板或类似的东西中)。

在服务器端触发事件的方式如下:

if (Request.Form["__EVENTTARGET"] == "GridView1")
{
//fire event
string argument = Request.Form["__EVENTARGUEMENT"];
//do something.
}

更新重要的是我的代码中的“参数”部分,因为它将包含该人以 Select$<RowNumber> 形式单击的行。

我想您需要利用这些信息做一些事情。

关于javascript - 涉及 Webgrid 的 Ajax 帮助,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7501676/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com