I am creating a website in asp.net. My website has an admin page. The admin will use this page to daily update website's content. This content will get reflected to the main website.
I am using Application variable to pass values from one page to another.
Admin.aspx
Admin.aspx.cs
Home.aspx
To set the paragraph, I want to do something like below. But it is not recognising the paragraph Id.
Home.aspx.cs
How do I set the paragraph?
Both Admin and Home page are under the same solution.
I am using Application variable to pass values from one page to another.
Admin.aspx
C#:
<form runat="server">
<div>
<asp:TextBox id="DailyMsgID" name = "DailyMsgName" runat="server"></asp:TextBox>
<asp:Button id="b1" Text="Submit" runat="server" OnClick="b1_Click" />
<asp:Label ID="Label_DailyMsgId" name="Label_DailyMsgName" runat="server" Text="Label"></asp:Label>
</div>
</form>
</body>
Admin.aspx.cs
C#:
protected void b1_Click(object sender, EventArgs e)
{
Label_DailyMsgId.Text = DailyMsgID.Text;
Application["DailyMessage"] = Label_DailyMsgId.Text;
}
Home.aspx
C#:
<!-- Page content-->
<div id="div1" class="container-fluid">
<h1 id="myhead" class="mt-4">Welcome to the Official Website of ABC</h1>
<p id="DailyMessage"></p>
</div>
To set the paragraph, I want to do something like below. But it is not recognising the paragraph Id.
Home.aspx.cs
C#:
protected void Page_Load(object sender, EventArgs e)
{
DailyMessage.Text = Application["DailyMessage"].ToString();
}
How do I set the paragraph?
Both Admin and Home page are under the same solution.