Click here to Skip to main content
15,896,063 members

i want to change in text of labelcontrol permanently

rinku5555 asked:

Open original thread
defaut.aspx page coding

XML
</head>
<body>
    <form id="form1" runat="server">
    <div>
        welcome: &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;
        <asp:Label ID="Label1" runat="server" Font-Bold="True" Text="Label"></asp:Label><br />
        You visted on: &nbsp;
        <asp:Label ID="Label2" runat="server" Font-Bold="True" Text="Label"></asp:Label></div>
        <br />

        <hr width="40%" align="left" />
        <br />
        <br />

        Enter your name: &nbsp;&nbsp;
        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>&nbsp;
        <asp:Button ID="Button1" runat="server" Text="Save"  />
    </form>
</body>
</html>


defaut.aspx.cs coding

C#
public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

       

            string hh;
            hh = Request.QueryString["name"].ToString();
            Profile.Name = hh;
            Profile.Save();
            Label1.Text = hh;
       
    protected void Page_UnLoad(object sender, EventArgs e)
    {
        Profile.VisitedOn = DateTime.Now;
        Profile.Save();
    }


gg.aspx 

 page coding from which i will send a name to default page through
query string

<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:TextBox ID="TextBox1" runat="server">
        <asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
    
    </div>
    </form>
</body>
</html>
    

gg.aspx.cs

 protected void Page_Load(object sender, EventArgs e)
    {
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        Response.Redirect("default.aspx?name=" + TextBox1.Text);
    }
}



now question is that values changed of label in default.aspx page when i go from gg.aspx page to defaut.aspx page but when i open directly default.aspx page 
values of label text retained.
i want that when i enter through default.aspx page values shoud be changed.
plzz anybody
Tags: ASP.NET4.0

Plain Text
ASM
ASP
ASP.NET
BASIC
BAT
C#
C++
COBOL
CoffeeScript
CSS
Dart
dbase
F#
FORTRAN
HTML
Java
Javascript
Kotlin
Lua
MIDL
MSIL
ObjectiveC
Pascal
PERL
PHP
PowerShell
Python
Razor
Ruby
Scala
Shell
SLN
SQL
Swift
T4
Terminal
TypeScript
VB
VBScript
XML
YAML

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the http://www.codeproject.com/info/cpol10.aspx.



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900