I want to display a pop up on each div click.the divs will create dynamically and each is boxes.I want to display some database values inside my pop up.I used hidden field(to get id) as a control parameter in sql datasource.To get the hidden field values on each click from c#,i used some _dopostback in javascript of my pop up plug in. This causes page loading on every refresh and hence I cant display proper values in my popup on each click. How can i avoid page refresh? my javascript code:
in pop up function i called
__doPostBack('TestFunctionPostBack', comp_id);
c# code in page load
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;
}
}
You can use AJAX to avoid a full page post back.
You could easily add an UpdatePanel
for a partial post back. Or, even better, use a javascript framework such as jQuery .
使用Ajax调用服务器端方法然后在UI上呈现内容查看以下示例http://weblogs.asp.net/craigshoemaker/archive/2008/09/29/using-jquery-to-call-asp-net- Ajax的页面methods.aspx
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.