在asp.net中调用父页面的服务器端功能 [英] call server side function of parent page in asp.net
问题描述
嗨
我在asp.net应用程序中使用jquery(jquery.colorbox.js)打开一个弹出页面(子页面).现在,当我单击搜索按钮时,我想关闭弹出页面(子页面)并使用搜索参数刷新UpdatePanel1
.
对于上述,我需要在父页面中执行服务器端功能.
因此,请任何人能帮助我如何在关闭弹出页面时调用服务器端函数,并且我应该能够在服务器端函数中获取搜索参数值.
关闭弹出的代码:
child.aspx:
Hi
I open a pop up page(child page) by using jquery(jquery.colorbox.js) in asp.net application. Now when I click on search button I want to close the pop up page(child page) and refresh the UpdatePanel1
by using search parameters.
for above I need to execute server side function in parent page.
So please can any one help me how can I call server side function while closing pop up page and I should be able to get search parameter values in server side function.
Code to close pop up:
child.aspx:
<script>
function closePopup() {
parent.$.fn.colorbox.close();
return true;
}
</script>
child.aspx.cs:
child.aspx.cs:
protected void Page_Load(object sender, EventArgs e)
{
btnSearch.Attributes.Add("onClick", "return closePopup();");
}
protected void btnSearch_Click(object sender, EventArgs e)
{
}
推荐答案
.fn.colorbox.close(); 返回 真; } </script>
.fn.colorbox.close(); return true; } </script>
child.aspx.cs:
child.aspx.cs:
protected void Page_Load(object sender, EventArgs e)
{
btnSearch.Attributes.Add("onClick", "return closePopup();");
}
protected void btnSearch_Click(object sender, EventArgs e)
{
}
有几种方法.
一种是可以有一个隐藏字段,并在关闭弹出窗口时在客户端设置搜索参数,并在服务器端获取此隐藏字段的值.
There can several ways.
One is that you can have a hidden field and set your search parameters at client side while closing popup and get the value of this hidden field at server side.
这篇关于在asp.net中调用父页面的服务器端功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!