The ProgrammersTalk Community
Forum Register Search Today's Posts Mark Forums Read
Register

Go Back   The ProgrammersTalk Community > Web Programming > ASP / ASP.NET


Welcome to the The ProgrammersTalk Community forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.
Tags:

Closed Thread
 
LinkBack Thread Tools    Display Modes   
  #1 (permalink)  
Old 06-10-2007, 04:32 PM
Maverick
Posts: n/a
[SOLVED] Help with Master Page / Content Page in ASP.NET?

I designed a Master Page with three link buttons in it: lnk1, lnk2 and lnk3. I have also designed a content page that inherits from the Master Page (I just added an extra property on the topmost line of the Content-Page's Source that says " MasterPageFile="~/MP1.master" ")

I would like to add new events (i.e. override them) for the above three links in my Content Page. By default, those links do nothing - what should I do to override the links and add new events that occur by clicking on them?

The programming language involved here is C#, therefore no VB coding please.

__________________

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
  #2 (permalink)  
Old 06-10-2007, 04:33 PM
Smutty Smutty is offline
Novice
Join Date: Jun 2007
Posts: 9
iTrader: (0)
Smutty is on a distinguished road
I think you can do a trick to produce the same result. I am not sure if the "overriding the events" itself is possible.

However what I imaging is possible is to leave your controls in the Master Page unwired. In the content page's Page_Init method, reference the control in your master page and wire its event. For example:

protected void Page_Init(object sender, EventArgs e)
{
( ( LinkButton )Master.FindControl( "MyLinkBtn" ) ).Click += new EventHandler( this.MyLinkBtn_Click);
}

Hope this helps.

__________________
Powered by Yahoo! Answers
Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
  #3 (permalink)  
Old 06-10-2007, 04:34 PM
soheilnb
Posts: n/a
I think there would be someway to do that although it might seem messy. It's fortunate that your event handler in the master page does not do anything originally, so you needn't check some flag in the event args to verify whether you should cancel the original behavior or not. consider using a public dummy class which fires events in the master page. In the content page add a handler for that. make the object in the master page public so that your content page can see it by casting. Good luck.

__________________

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
Closed Thread


Thread Tools
Display Modes

   Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -7. The time now is 12:40 PM. Powered by vBulletin
Copyright © 2000 - 2007, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO © 2007 ProgrammersTalk Sedo - Buy and Sell Domain Names and Websites project info: programmerstalk.net Statistics for project programmerstalk.net etracker® web controlling instead of log file analysis


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50