Master Page按钮单击调用子页面中的子例程 [英] Master Page button click calls a subroutine in Child page

查看:65
本文介绍了Master Page按钮单击调用子页面中的子例程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在母版页中有一个按钮。



子页面(即.aspx)有一个名为display()的子程序。



这里子页面包含GridView。



对于那个Childpage GridView,输入值是从Masterpage组件(即文本框)给出的。



子页面中的子例程在子页面的button_Click中调用。我要在MasterPage的button_Click中调用的子例程。有可能吗?



如果可能,请提供示例代码,了解如何在Masterpage button_click中调用display()子程序。



谢谢

Priya

解决方案

检查此链接:

http://dotnetstack.com/2011/07/11/master-page-events- in-content-pages-asp-net / [ ^ ]


您是否尝试过使用 C#Delegate with event handler [ ^ ]?只需看看这个例子 [ ^ ]。





--Amit

最后我通过会话变量得到了解决方案。



我在主页按钮中创建会话变量点击一个页面重定向到子页面我通过了那些我的子程序中的变量。



主页代码:

 session(  column1)= TextBox1.Text 
session( < span class =code-string> column2)= TextBox2.Text
' session (column1),session(column2)等依赖于我们正在进行的输入,它们应该在子页面子例程中传递。



感谢所有人帮助我!!!

I am having a Button in Master Page.

The Child page (ie., .aspx) is having a subroutine with the name display().

Here child page is containing the GridView.

For that Childpage GridView, input values are given from Masterpage components (ie., textbox).

The subroutine in the childpage is called in button_Click of the Childpage. That subroutine I want to call in MasterPage''s button_Click. Is it possible ?

If possible please provide sample code for how to call display() subroutine in Masterpage button_click.

Thanks
Priya

解决方案

Check this link:
http://dotnetstack.com/2011/07/11/master-page-events-in-content-pages-asp-net/[^]


Did you tried using a C# Delegate with event handler[^]? Just have a look at this example[^].


--Amit


Finally I got solution through session variables.

I created session variables in masterpage button click with a page redirecting to childpage and I passed those variables in my subroutine.

Masterpage code:

session("column1")=TextBox1.Text
session("column2")=TextBox2.Text
'session("column1"), session("column2") and so on depending upon no of inputs we are taking and they should be passed in child page subroutine.


Thanks all for helping me!!!


这篇关于Master Page按钮单击调用子页面中的子例程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆