Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8948319
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T12:57:13+00:00 2026-06-15T12:57:13+00:00

I used the code below to make a change in div of the page

  • 0

I used the code below to make a change in div of the page of this code file:

HtmlGenericControl divTest = Page.FindControl("test") as HtmlGenericControl;   
divTeste.InnerText = "tested";

But now, I want to change another page. Ex.: default.aspx code behind changes a div inner text in the test.aspx …

The code above isn’t appropriated. I want permanent changes. What code should be?

How can I do it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T12:57:14+00:00Added an answer on June 15, 2026 at 12:57 pm

    You need to understand how ASP.NET works. Introduction to ASP.NET

    If you are on Default.aspx and then wont to move to Test.aspx you can use values from Default.aspx in Test.aspx however you can’t just change different pages from the page you are on. (Actually it is possible by writing data to a database and then later accessing that data on the page you want to change but for your example I don’t believe you are looking for something like that)

    The closest to your example I can think of is using a Query string.

    Default.aspx Markup

    <asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
    

    Default.aspx Code behind

    protected void Button1_Click(object sender, EventArgs e)
    {
        Response.Redirect("Test.aspx?DivMSG=Hello");
    }
    

    Test.aspx Markup

    <div id="MyTestDiv" runat="server">
    
    </div>
    

    Test.aspx Code Behind

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            MyTestDiv.InnerText = Request.QueryString["DivMSG"];
        }
    }
    

    Update:

    One way to make it permanent is to write it to a database. A quick example but you need to do the database code

    Default.aspx Markup

    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
    <asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
    

    Default.aspx Code behind

    protected void Button1_Click(object sender, EventArgs e)
    {
        string messageToWriteToTestDiv = TextBox1.Text;
    
        // Code: to write messageToWriteToTestDiv to the database
    }
    

    Test.aspx Code Behind

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string myMessage = "";
    
            // Code: string myMessage = Get Message from Database to write to div
    
            MyTestDiv.InnerText = myMessage;
        }
    }
    

    Test.aspx Markup

    <div id="MyTestDiv" runat="server">
    
    </div>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I get this error when I run the code below. I have normally used
I have used the code below to read rfid tag values. try { if
I want to load wordpress in a smarty template. I used the code below
I have used below code to attach quckboook events // Subscribe to UI events...
Code below is used to save PostgreSql database backup from browser in Apache Mono
I had used the below code to get the row index of the UIPickerView
I coded the code below. I've used it in my program and it seems
I am having a very specific problem in JQuery The code below is used
// .net 2.0 and vs2005 used. I find some code below. I am not
I'm new to groovy, and I've used the ExcelBuilder code referenced below to iterate

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.