【发布时间】:2012-05-22 21:53:22
【问题描述】:
我想在每个 div 点击时显示一个弹出窗口。div 将动态创建,每个都是框。我想在弹出窗口中显示一些数据库值。我使用隐藏字段(获取 id)作为控制参数在 sql 数据源中。为了从 c# 中获取每次点击时的隐藏字段值,我在弹出插件的 javascript 中使用了一些 _dopostback。 这会导致页面在每次刷新时加载,因此我无法在每次点击时在弹出窗口中显示正确的值。 如何避免页面刷新? 我的 JavaScript 代码:
在我调用的弹出函数中
__doPostBack('TestFunctionPostBack', comp_id);
页面加载中的c#代码
this.GetPostBackEventReference(this, string.Empty);
if (this.IsPostBack)
{
string eventTarget = (this.Request["__EVENTTARGET"] == null) ? string.Empty : this.Request["__EVENTTARGET"];
string eventArgument = (this.Request["__EVENTARGUMENT"] == null) ? string.Empty : this.Request["__EVENTARGUMENT"];
if (eventTarget == "TestFunctionPostBack")
{
HiddenField1.Value = eventArgument;
}
}
【问题讨论】:
-
回发是页面刷新
标签: c# javascript jquery