Click here to Skip to main content
12,354,763 members (60,660 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: VB ASP.NET VB.NET
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 2-Jan-13 20:03pm
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

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


--Amit
  Permalink  
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!!
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 4

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!!!
  Permalink  

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160621.1 | Last Updated 11 Jan 2013
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100