Click here to Skip to main content
16,015,032 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Posted

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:
VB
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!!!
 
Share this answer
 
Did you tried using a C# Delegate with event handler[^]? Just have a look at this example[^].


--Amit
 
Share this answer
 
Comments
manipriya621 4-Jan-13 0:20am    
Actually subroutine and GridView code is in child page . I need to execute the code under ButtonClick in childpage when i click the button in master page.ie Masterpage button click has to execute code in childpage button code which in-turn contains the subroutine display(). That subroutine is having the search code that is to be displayed in GridView.
manipriya621 4-Jan-13 0:23am    
The following is Masterpage code

Public Sub BtnDisplay1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnDisplay1.Click
Dim contentPage As ContentPlaceHolder = DirectCast(FindControl("ContentPlaceHolder1"), ContentPlaceHolder)
Dim button = DirectCast(contentPage.FindControl("BtnDisplay"), Button)
End Sub
We can raise master page button click event in child page as
Public Sub BtnDisplay_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnDisplay.Click
Me.Master.BtnDisplay1_Click(sender, e)
End Sub
Is there any reverse process for the above master page buttonclick to raise childpage button click event?
please help me!!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900