CodeVerge.Net Beta


   Explore    Item Entry    Members      Register  Login  
NEWSGROUP
.NET
Algorithms-Data Structures
Asp.Net
C Plus Plus
CSharp
Database
HTML
Javascript
Linq
Other
Regular Expressions
VB.Net
XML

Free Download:




Zone: > NEWSGROUP > Asp.Net Forum > general_asp.net.master_pages_themes_and_navigation_controls Tags:
Item Type: NewsGroup Date Entered: 8/14/2006 3:09:34 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 7 Views: 21 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
8 Items, 1 Pages 1 |< << Go >> >|
grakaman
Asp.Net User
How to access a control of a Master Page?8/14/2006 3:09:34 PM

0/0

Hi

I have a Master Page that contains a Panel control. This Panel control also contains two TextBox controls and a Button control.Now you type something within the TextBox controls and hit the button to trigger a PostBack. In the event handler method i call the Server.Transfer method to switch to another aspx page. This new aspx page also uses the Master Page template. Now, i want to access the values of the two TextBox controls of the Master Page from the Page_Load event handler. I use the Master.FindControls() to search for the controls. It seems that i get the instances of these controls, but their Text properties has no values. How can i get the Text propertie values of the TextBox controls? Many thanks in advance

 

regards,

grakaman

LudovicoVan
Asp.Net User
Re: How to access a control of a Master Page?8/14/2006 6:07:35 PM

0/0

Hello grakaman:

> In the event handler method i call the Server.Transfer method to switch to another aspx page. This new aspx page also uses the Master Page template. Now, i want to access the values of the two TextBox controls of the Master Page from the Page_Load event handler.

The target page using the same Master doesn't help here. You need acces to the controls on the previous page instead. For this, the fwk provides a Page.PreviousPage property into the target page, which is defined in case you issue a Server.Transfer or a cross-page postback (otherwise it is null). So i guess your code should look something like:

   PreviousPage.Master.FindControl(...);

HTH. -LV


Julio P. Di Egidio
Software Analyst / Programmer
http://julio.diegidio.name

(Peace X Love] = [++1)
grakaman
Asp.Net User
Re: How to access a control of a Master Page?8/15/2006 6:44:59 AM

0/0

Tthats it. Thanks ;)

mychucky
Asp.Net User
Re: How to access a control of a Master Page?8/15/2006 3:29:00 PM

0/0

I have a similar situation. I have a SqlDataSource1 in the master page. In the client page of the master page, I want to access the SqlDataSource1 that is on the master page. How do I do it?
LudovicoVan
Asp.Net User
Re: How to access a control of a Master Page?8/15/2006 4:29:05 PM

0/0

mychucky:

> I have a similar situation. I have a SqlDataSource1 in the master page. In the client page of the master page, I want to access the SqlDataSource1 that is on the master page. How do I do it?

You are not in the context of a Server.Transfer, right? Then, i guess just something like:

   Page.Master.FindControl("SqlDataSource1")

HTH. -LV


Julio P. Di Egidio
Software Analyst / Programmer
http://julio.diegidio.name

(Peace X Love] = [++1)
mychucky
Asp.Net User
Re: How to access a control of a Master Page?8/15/2006 6:09:28 PM

0/0

Thanks for the response. Here is what I have:
SqlDataSource sqlEnewsMnuMaster = new SqlDataSource();
sqlEnewsMnuMaster = this.Master.FindControl("sqlEnewsMnu");
 The compilation error I got is:

Error    1    Cannot implicitly convert type 'System.Web.UI.Control' to 'System.Web.UI.WebControls.SqlDataSource'. An explicit conversion exists (are you missing a cast?)    T:\enews\test.aspx.cs    68    45    T:\

mychucky
Asp.Net User
Re: How to access a control of a Master Page?8/15/2006 6:14:24 PM

0/0

Okay, I tried this:
sqlEnewsMnuMaster = (SqlDataSource)this.Master.FindControl("sqlEnewsMnu");
 And there is no errors.

My next question is, how do I call a method that is on the Master page?
LudovicoVan
Asp.Net User
Re: How to access a control of a Master Page?8/15/2006 9:17:22 PM

0/0

mychucky:

> My next question is, how do I call a method that is on the Master page?

Define a public method in your master page class, then call it as usual with something like:

   ((MyMaster)Page.Master).MyMethod();

You can avoid the cast, that is have a strongly typed master reference, with the @MasterType directive in your content page.

Btw, netiquette tells: new question => new topic... ;)

HTH. -LV


Julio P. Di Egidio
Software Analyst / Programmer
http://julio.diegidio.name

(Peace X Love] = [++1)
8 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
Pro ASP.NET 3.5 in C# 2008 Authors: Matthew MacDonald, Mario Szpuszta, Pages: 1498, Published: 2007
Pro ASP.NET 2.0 in VB 2005: From Professional to Expert Authors: Laurence Moroney, Matthew MacDonald, Pages: 1253, Published: 2006
Pro ASP.NET 2.0 in C# 2005 Authors: Matthew MacDonald, Mario Szpuszta, Pages: 1255, Published: 2005
ASP.NET 2.0 Website Programming: Problem-design-solution Authors: Marco Bellinaso, Pages: 576, Published: 2006
Professional ASP.NET 3.5: In C# and VB Authors: Bill Evjen, Scott Hanselman, Devin Rader, Pages: 1673, Published: 2008
Professional ASP.NET 2.0 Databases Authors: Thiru Thangarathinam, Pages: 504, Published: 2007
Pro ASP.NET 2.0 Website Programming Authors: Damon Armstrong, Pages: 641, Published: 2005
Pro ASP.NET 2.0 in C# 2005: Create Next-generation Web Applications with the Latest Version of Microsoft's Revolutionary Technology Authors: Matthew MacDonald, Mario Szpuszta, Pages: 1426, Published: 2006
C# for Programmers: Updated for C# 2.0 Authors: Paul J. Deitel, Pages: 1317, Published: 2005
Visual Basic 2005: How to Program Authors: Harvey M. Deitel, Pages: 1513, Published: 2006

Web:
Working with ASP.NET Master Pages Programmatically However, you can use the FindControl method to locate specific controls on the master page. If the control that you want to access is inside a ...
CodeProject: Inside Master Pages. Free source code and programming ... Let’s say that I have a ListBox control on the master page called listBox1 . And I want to access it. We don’t need to add any code in the master page. ...
How to access a control in master page? Talk about How to access a control in master page?
How to access a control of a Master Page? - ASP.NET Forums Re: How to access a control of a Master Page? 08-14-2006, 2:07 PM ... Re: How to access a control of a Master Page? 08-15-2006, 2:44 AM ...
Access property and control of master page from a customized ... Btw, I can access the server control of master page from base page class via Cast + FinndControl, however this method doesn't work on access ...
Page 3 - How to Use Master Pages (Conclusion) Dec 8, 2005 ... How to expose a master page control as a public property. The easiest way to access a control on a master page from a content page is to ...
p2p.wrox.com Forums - Access Master page control from Content page. p2p.wrox.com Forums - access master page control from content page. ... How can I access controls of Master Page from Content Page? ...
Access contentpage control from master page - ASP.NET Access contentpage control from master page - ASP.NET Community and Forum - Our ASP.NET forum is the place for Q&A-style discussions related to the ...
How to access a control in the masterpage ? Access a master page control from your ASP.NET pages using the code snippet below.
Access Master Page Control from User Control (client side ... I would like to access the radPane control located on the MasterPage used by the same page that consumes the User Control with the ...

Videos:
Access 2000 (05) Web Security The Access 2000 (05) Web Security is part of KeyStone Learning Systems library of more than 1,200 CD-ROM and video-based information technology cours...
Access 2000 (05) Web Security The Access 2000 (05) Web Security is part of KeyStone Learning Systems library of more than 1,200 CD-ROM and video-based information technology cours...
[CarbonCopyPRO]+[BiB]+[Greg McMahon]=[Home Business Success] https://oneyearplan.net/ldm/thankyou2.php Hi, this is Greg McMahon and I am a Top Earner utilizing the CarbonCopyPro Marketing System. if you want t...
Access 2000 (05) Web Security The Access 2000 (05) Web Security is part of KeyStone Learning Systems library of more than 1,200 CD-ROM and video-based information technology cours...
(Wealth Masters) *FORBIDDEN* Training Video Wealth Masters (WEALTH MASTERS) FORBIDDEN TRAINING will teach you how to put a powerhouse marketing division into your Wealth Masters business!!! Wealthmasters wea...
Access 2000 (05) Web Security The Access 2000 (05) Web Security is part of KeyStone Learning Systems library of more than 1,200 CD-ROM and video-based information technology cours...
37013 BRADY CREEK ROAD, RICHMOND, MO. 64085 Privacy and serenity comes to mind as you enter the drive to a 10 acre, one of a kind 2,998 sq ft. lovely 1 & 1 ½ story timber framed home with stone...
Access 2000 (05) Web Security The Access 2000 (05) Web Security is part of KeyStone Learning Systems library of more than 1,200 CD-ROM and video-based information technology cours...
Access 2000 (05) Web Security The Access 2000 (05) Web Security is part of KeyStone Learning Systems library of more than 1,200 CD-ROM and video-based information technology cours...
U.S. Slow Descent into Fascism 1 http://www.mc8.org THE END OF AMERICA United States is on the road to becoming a fascist society, right under our very noses.The Ten Steps of the F...




Search This Site:










activedirectorymembershipprovider always fails the login

rfi: does a module exist for integration of im client ?

sending data from html page to aspx (strange)

problem with ajax control toolkit and smart tags

csk 2.0 ordersprovider error - cannot create an abstract class

membership?

same code behind with multiple .aspx page

another code to create new folder

why there is error in line 79

new express contest - $10,000 and all it takes to start is an idea...

focus button

custom security and roles

port 8080 in use/net matrix sever problem

can you use a usercontrol as an editorpart?

export data to msword

is there a way to print out the code behind in a smaller font?

customised registration - module request

error: printable version of module

please someone help !!!

preventing multiple users use the same account

unmanaged debugging with asp.net 2

"object required" error

unable to connect to server

textbox change event...

asp.net rc1 - master file confuzion - ...matches the 'inherits' attribute, and that it extends the correct base class

using both c# and vb.net in asp.net application

fulltrust required to execute blog

skinning 2.0.4 to 2.1.2 problem

if you were starting to scope a .net project *now*...

problems with cacheing an xml document

 
All Times Are GMT