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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:55:01+00:00 2026-06-17T09:55:01+00:00

i have a small form on SharePoint application page: <form method=post id=registration-form action=default.aspx class=form-general

  • 0

i have a small form on SharePoint application page:

 <form method="post" id="registration-form" action="default.aspx" class="form-general cf" data-querycompletion-url="ajax/searchinstant.aspx">
     <input type="text" id="name" name="name" placeholder = "Your name" runat="server" />
          <input type="text" id= "company" name="company" placeholder= "Your company" runat="server"/>
    <input type="text" id="srchtxtx" class="search" name="visitor" placeholder="visitor" runat="server" />
    <input name="btnConfirm" id="Submit1" class="right" value="register" type="submit" runat="server" /></form>

At codebehinde of default.aspx, i want to access values as:

string val1 = name.value;
string val2 = company.value;
string val3 = srchtxtx.value;

But the above returns empty string in val1, val2 nd val3 respectively. But if I remove runat = "server" from <input> tags, then i can access values successfully as:

string val1 = Request.Form["name"];
string val2 = Request.Form["company"];
string val3 = Request.Form["visitor"];

The question is why it returns empty string values when I use runat = "server" in <input> tags ??
Due to some reasons, I could not remove runat = "server" from <input> tags.

Is there any other way to access <input> values at codebehind while assuming runat = “server” attribute in <input> ??

I am also restricted not to use <asp:TextBox> control.

  • 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-17T09:55:02+00:00Added an answer on June 17, 2026 at 9:55 am

    As I hinted in html form submitted with null values, this is because the form does not runat="server" so the postback data is not processed by asp.net, i.e. properties of srchtxtx etc are not populated.

    However html elements are still given unique ids on the page, so you cannot just do Request.Form["srchtxtx"];

    To get around this, you can use the UniqueID of the input element to get the posted back value:

    HTML

    <form method="post" id="registration-form" action="default.aspx" class="form-general cf" data-querycompletion-url="ajax/searchinstant.aspx">
        <input type="text" id="srchtxtx" name="srchtxtx" runat="server" />
        <input name="btnConfirm" id="Submit1" class="right" value="register" type="submit" runat="server" />
    </form>
    

    C#

    protected void Page_Load(object sender, EventArgs e)
    {
        string val1 = srchtxtx.Value; // always ""
        string val2 = Request.Form["srchtxtx"]; // always null
        string val3 = Request.Form[srchtxtx.UniqueID]; // input value
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a small contact form: <form method=post action=contact.php name=contactform id=contactform> <fieldset> <legend>Please fill
If I have a simple html page with a small form whose data I'd
In my c# application i have this small form which is used to set
Post-release, I have made one small change to one form in our development site
I have written a small HTML form and added it to the page. My
i have a page,say abc.html, that is having a small form with some fields.
I have a web page with a small form in it. HTML code for
I have a page which has a small form with one input field and
I have a small form on the page that looks like <div id=updater> <%=
I have a page with a couple of grids and a small form with

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.