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 9235707
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T07:06:56+00:00 2026-06-18T07:06:56+00:00

I have a asp.net page like default.aspx containing: <form id=form1 runat=server > <asp:Textbox id=Textbox1

  • 0

I have a asp.net page like “default.aspx” containing:

<form id="form1" runat="server" >        
    <asp:Textbox id="Textbox1" runat="server" />
    <asp:Button id="Button1" runat="server" onClick="Button1_Click" text="submit" />
</form>

What I want is keeping text value in textbox field while user returned from other subpages.
So in .cs file I try this:

protected void Button1_Click(object sender, EventArgs e){
    Session["Data"] = Textbox1.Text;
}

public string Data{get{return Session["Data"].ToString();}}      

and in.aspx:

<asp:Textbox id="Textbox1" runat="server" text="<%# Data %>" />

but it do not work, the textbox field gets blank.
How to implement this without javascript?

  • 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-18T07:06:57+00:00Added an answer on June 18, 2026 at 7:06 am

    The # works only in databinding expressions. So you need (e.g. in Page_Init)

    Page.DataBind();
    

    for this to work

    <asp:Textbox id="Textbox1" runat="server" text="<%# this.Data %>" />
    

    otherwise this might also work

    <asp:Textbox id="Textbox1" runat="server" text="<%= this.Data %>" />
    

    inline asp.net tags… sorting them all out (<%$, <%=, <%, <%#, etc.)

    As already commented, in general it’s better to use the codebehind since you have compile time checking then.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have my asp.net sub-master page setup like this: <asp:Content ID=MainContent runat=server ContentPlaceHolderID=mainContent> <!doctype
I have an ASP.Net Page, aspx with its default form. I have a Submit
ASP.NET restricts using more than 1 runat=server form. I have a Master Page ,
I have asp.net page like this: Default.aspx: <%@ Page Title=Home Page Language=C# MasterPageFile=~/Site.master AutoEventWireup=true
I have an Asp .net page like this simple one http://issamsoft.com/app2/page1.aspx and I want
I am using asp.net/C# for my project.Currently i have a default.aspx page and a
I have an ASP.NET project. Currently, it starts on the Default.aspx page. However, I’d
I have created a blank asp.net website consisting of a blank default.aspx page, its
I have a label on my asp.net page, it looks like this: more info
I have a master page in my asp.net MVC project, which has code like

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.