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

  • Home
  • SEARCH
  • 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 7726429
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T05:12:45+00:00 2026-06-01T05:12:45+00:00

I have a variable which I get from database I want to output this

  • 0

I have a variable which I get from database I want to output this variable in the aspx page in between the html.
I tried to make it public but it shows some error, how can I use a variable set in page load function in its aspx page?

  • 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-01T05:12:47+00:00Added an answer on June 1, 2026 at 5:12 am

    First way

    You place a Literal control in the point you want to display the variable and then you set on PageLoad this value to the Literal Control

    <asp:Literal runat="server" id="txtValueA" EnableViewState="false" />
    

    and on code behind.

    txtValueA.Text = "one of the basic";
    

    This way you have also more control over what you try to render out.

    Second way

    The other way is to make it public as you say and print it when the page render. This is a different way, but not a better one.

    public string cMyValue = "some string here";
    

    and on aspx page

    <%=cMyValue%>
    

    This way you get the parameter when the page renders at run time and send this in run time on the Client.
    If you try this way inside an updatepanel, then the update is fail because the update panel can not read and render again the full page but only the code behind.

    Try to avoid this way, and use it only when you really needed it because this make a call to the code the moment its try to render the page and change the page…

    One idea to use this way is when you have some extra calculation that you like to make, you flush the content and then you call a function with extra time cost. For example.

    <%
      Response.Flush();
      Response.Write(CallATimeConsumeFunctionThatReturnString());
    %>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a variable called $tags , which just references from a database field.
I have a PHP-variable called $go_Adress which contains the adress I need to get
I have a variable which contains 3 tag names which are separated from each
I have a web based program which chooses some records from a database using
How do I use PDO FetchObject results with the $this variable? Have a page
so i have a form at sampleform.html which accepts user's value [This is a
I have a url which has some get variables in it like: domain.com/recover?email=my@email.com&token=abc123 inside
i have variable $lang which convert string to the selected language but i am
I have a variable which contains the value 1234567 . I would like it
I have a variable which has the directory path, along with the file name.

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.