Click here to Skip to main content
15,918,742 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Error - Only when publishing Pin
enjoycrack30-Mar-07 15:09
enjoycrack30-Mar-07 15:09 
GeneralRe: Error - Only when publishing Pin
Hmitosh30-Mar-07 19:29
Hmitosh30-Mar-07 19:29 
GeneralRe: Error - Only when publishing Pin
Hmitosh30-Mar-07 19:43
Hmitosh30-Mar-07 19:43 
GeneralRe: Error - Only when publishing Pin
enjoycrack31-Mar-07 6:30
enjoycrack31-Mar-07 6:30 
GeneralRe: Error - Only when publishing Pin
Hmitosh31-Mar-07 8:33
Hmitosh31-Mar-07 8:33 
QuestionVIew State in CustomControl Pin
faiqshah30-Mar-07 10:45
faiqshah30-Mar-07 10:45 
QuestionMasterpage-Contentpage Data Sharing Pin
RickyD230-Mar-07 10:40
RickyD230-Mar-07 10:40 
AnswerRe: Masterpage-Contentpage Data Sharing Pin
kubben30-Mar-07 11:27
kubben30-Mar-07 11:27 
If you set the MasterType Page directive, then your page will know what kind of master page it is in. Then you should be able to access controls on the master page.

<%@ MasterType virtualpath="~/Masters/Master1.master" %>


Here is some sample code from microsoft help:
Visual Basic
<pre>
Sub Page_Load()
Dim mpContentPlaceHolder As ContentPlaceHolder
Dim mpTextBox As TextBox
mpContentPlaceHolder = _
CType(Master.FindControl("ContentPlaceHolder1"), _
ContentPlaceHolder)
If Not mpContentPlaceHolder Is Nothing Then
mpTextBox = CType(mpContentPlaceHolder. _
FindControl("TextBox1"), TextBox)
If Not mpTextBox Is Nothing Then
mpTextBox.Text = "TextBox found!"
End If
End If

' Gets a reference to a Label control not in a
' ContentPlaceHolder
Dim mpLabel As Label
mpLabel = CType(Master.FindControl("masterPageLabel"), Label)
If Not mpLabel Is Nothing Then
Label1.Text = "Master page label = " + mpLabel.Text
End If
End Sub
</pre>

C#
<pre>
void Page_Load()
{
// Gets a reference to a TextBox control inside
// a ContentPlaceHolder
ContentPlaceHolder mpContentPlaceHolder;
TextBox mpTextBox;
mpContentPlaceHolder =
(ContentPlaceHolder)Master.FindControl("ContentPlaceHolder1");
if(mpContentPlaceHolder != null)
{
mpTextBox =
(TextBox) mpContentPlaceHolder.FindControl("TextBox1");
if(mpTextBox != null)
{
mpTextBox.Text = "TextBox found!";
}
}

// Gets a reference to a Label control that not in
// a ContentPlaceHolder
Label mpLabel = (Label) Master.FindControl("masterPageLabel");
if(mpLabel != null)
{
Label1.Text = "Master page label = " + mpLabel.Text;
}
}
</pre>

Hope that helps.
Ben
GeneralRe: Masterpage-Contentpage Data Sharing Pin
RickyD22-Apr-07 7:55
RickyD22-Apr-07 7:55 
QuestionHow to call a method in another .aspx file Pin
r_jaz30-Mar-07 10:02
r_jaz30-Mar-07 10:02 
AnswerRe: How to call a method in another .aspx file Pin
_mubashir30-Mar-07 10:08
_mubashir30-Mar-07 10:08 
GeneralRe: How to call a method in another .aspx file Pin
faiqshah30-Mar-07 12:45
faiqshah30-Mar-07 12:45 
GeneralRe: How to call a method in another .aspx file Pin
r_jaz31-Mar-07 2:11
r_jaz31-Mar-07 2:11 
AnswerRe: How to call a method in another .aspx file Pin
Matglas16-Apr-07 3:21
Matglas16-Apr-07 3:21 
Questionhow to make Dll Pin
netJP12L30-Mar-07 9:22
netJP12L30-Mar-07 9:22 
AnswerRe: how to make Dll Pin
Neo_Shehpar30-Mar-07 13:38
Neo_Shehpar30-Mar-07 13:38 
AnswerRe: how to make Dll Pin
MinhajuddinK30-Mar-07 20:46
MinhajuddinK30-Mar-07 20:46 
QuestionInjecting Data into ObjectDataSource Pin
Tristan Rhodes30-Mar-07 6:24
Tristan Rhodes30-Mar-07 6:24 
AnswerRe: Injecting Data into ObjectDataSource Pin
kubben30-Mar-07 6:40
kubben30-Mar-07 6:40 
GeneralRe: Injecting Data into ObjectDataSource Pin
Tristan Rhodes31-Mar-07 6:26
Tristan Rhodes31-Mar-07 6:26 
Questionhow to create out website dll in asp.net2.0 Pin
Sankar Komma 30-Mar-07 5:11
Sankar Komma 30-Mar-07 5:11 
AnswerRe: how to create out website dll in asp.net2.0 Pin
kubben30-Mar-07 14:02
kubben30-Mar-07 14:02 
AnswerRe: how to create out website dll in asp.net2.0 Pin
N a v a n e e t h30-Mar-07 18:05
N a v a n e e t h30-Mar-07 18:05 
Questionimport and export in sqlserver 2000 Pin
saravanan0530-Mar-07 3:09
saravanan0530-Mar-07 3:09 
AnswerRe: import and export in sqlserver 2000 Pin
Sathesh Sakthivel30-Mar-07 3:15
Sathesh Sakthivel30-Mar-07 3:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.