asp.net - How to check which control fired in Master Page -


How can we get control that is removed inside a master page in which a panel of code behind it is also? I have the following layouts.

  Master page + --------- Panel ----------- + | Text box button 1 button. + ------------------------- + | -------- & gt; Child page + ------------------------- + | Get out of here! | + ------------------------- +   

When I try the following the target id is empty < / P>

  if (IsPostBack) {var targetID = Request.Form ["__EVENTTARGET"]; If (targetID! = Null & targetID! = String.Empty) {var targetControl = this.Page.FindControl (targetID); }}   

I have to find out which button was posted back.

**** Update ****

I tried the following link without success.

You event is your master page Offer to communicate with the page.

Create something like this in your masterpiece

  public event EventHandler Button1ClickEvent; Public Event EventHeader Button 2 CLAEvent;   

What's happening here is that you are creating an event that the master page can check a page that is listening to that page and setting fire on it By which it is indicated. In this case, event handler means you will pass EventArgs in the event code.

You send an event by doing this Protected Zero Button 1_Click (Object Sender, EventArgs e) {If (button 1ClickEvent! = Faucet) // This is a sub page Applying Button1ClickEvent (this, EventArgs.Empty); // event off fire off} Safe Button Button2_Click (Object Sender, EventArgs E) {If (Button2ClickEvent! = Zero) Button2ClickEvent (this, EventArgs.Empty); After this, to implement these incidents, wipe your page

to make it your page Add to definition

  <% @ MasterType VirtualPath = "~ / MasterPage.master"% & gt;   

Now you can access these pages inside your page code

  Private Zero Master_Button1Click (Object Sender, EventArgs e) // It is said when `Bolt 1 click event 'has been removed from your master page} Private Zero Master_Button2lick (Object Sender, EventArgse E) {// This is said when Button2ClickEvent has been removed from' Master2Page}) Secure Orign ( EventArgs e) {// Setup Handler Master for an Event Master. Button 1 click event + = new event here driver (masterbatten1 click); Master.Button2ClickEvent + = New EventHandler (Masterbaton 2 2 Liquid); }    

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -