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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T18:10:33+00:00 2026-05-13T18:10:33+00:00

I have an ASP.NET web form where I have an hidden field, like this:

  • 0

I have an ASP.NET web form where I have an hidden field, like this:

<form id="form1" runat="server" action="http://localhost/fa/Default.aspx">
        <div>
    <input id="requestData" type="hidden" name="requestData" value="" runat="server" />
    <asp:Button ID="btnPOST" Text="POST" runat="server" OnClick="do_POST" />
        </div>
    </form>

On the method do_POST I have this:

    protected void do_POST(object sender, EventArgs e)
        {
//requestDataField is of the type protected global::System.Web.UI.HtmlControls.HtmlInputHidden requestData;

            requestDataField.Text = "FOO!";
        }

When I submit the form (by pressing the button), it goes to the server (an handler) wheer I have this:

string requestData = context.Request.Form["requestData"];

I get an empty string..

But if I assign a value like this:

<input id="requestData" type="hidden" name="requestData" value="FOO" runat="server" />

I get the “FOO”

What am I missing?

  • 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-05-13T18:10:34+00:00Added an answer on May 13, 2026 at 6:10 pm

    The reason why it’s not doing it is because the method is called after the page has been post back. Meaning, it is actually working if you change .Text to .Value unfortunately by that time you have already read your form and it was an empty value. I remember working on a project where you could tell your form not to submit until a function has been run (but it was with a javascript that needed to run an complete before aspx submitted). You should try to see if there is a way to force your form to run your function BEFORE doing the postback.

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

Sidebar

Related Questions

I have a simple ASP.NET web form as below: <form id=form1 runat=server> <asp:TextBox ID=txt
If I have the following in an ASP.NET Web Form: <asp:TextBox runat=server ID=tbxUser/> and
I have coding like this in my asp.net web form application [asp.net 4.0] <ul
I currently have an ASP.Net Web Form that looks like this: Each section of
I have a pretty simple ASP.NET Web Form that looks a bit like the
I have a Telerik RadGrid in my asp.net web form Like Below : MasterTableView
I have an ASP.NET web form. This web form has an event handler that
I have an ASP.NET web form with several UpdatePanels and I would like to
I have a ASP.Net web form that contains both text box fields and hidden
I have an ASP.NET web form application that on the server side I need

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.