ASP.NET how to access public properties? -
I have two pages Page 1.aspx and page2.aspx both have code with partial organs i see page1.aspx But how do I use public property messages on page2.aspx?
public string message {get; Set; }
If there is a master page, and the other page that uses it, .
Master page
& lt; Body & gt; & Lt; Form id = "form1" runat = "server" & gt; & Lt; Div & gt; & Lt; ASP: literal runat = "server" id = "text manager" & gt; & Lt; / ASP: Literary & gt; & Lt; Br / & gt; & Lt; Asp: ContentPlaceHolder id = "ContentPlaceHolder1" runat = "server" & gt; & Lt; / ASP: ContentPlaceHolder & gt; & Lt; / Div & gt; & Lt; / Form & gt; & Lt; / Body & gt;
And the code behind
public partial class Dokimes_StackOverFlow_MasterPage: System.Web.UI.MasterPage {public string TextToMaster {get {return txtOnMaster.Text; } Set {txtOnMaster.Text = value; }} Secure Zero Page_load (object sender, eventAgps E) // Here I find control in client page Control FindMe = ContentPlaceHolder1.FindControl ("txtOut"); // And if I exist, then I set text to the client from master if (FindMe! = Null) {((Liberal) FindMe). Text = "get from master page"; }}}
and now page 1.aspx contains the preਿਾus master page
& asp: Content ID = "Content2" ContentPlaceHolderID = "ContentPlaceHolder1" Runat = "Server" & gt; & Lt; ASP: literal runat = "server" id = "txtut" & gt; & Lt; / ASP: Literary & gt; & Lt; / ASP: Content & gt;
More code
Secure Zero Page_load (Object Sender, EventArgs e) {// Here I am setting text on the master page from the client (( Dokimes_StackOverFlow_MasterPage) Master .extToMaster = "Set by Customer"; }
Comments
Post a Comment