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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T18:36:22+00:00 2026-06-16T18:36:22+00:00

Code in html: <input type=text name=fileName id=fileName class=file_input_textbox readonly=readonly /> <div class=file_input_div> <input type=button

  • 0

Code in html:

        <input type="text" name="fileName" id="fileName" class="file_input_textbox" readonly="readonly" />

        <div class="file_input_div">
          <input type="button" value="Search files" class="file_input_button" />
          <input type="file" class="file_input_hidden" onchange="javascript: document.getElementsByName('fileName')[0].value = this.value" />
        </div>

It’s work correctly. But if i will write like this:

<input runat="server" type="text" name="fileName" id="fileName" class="file_input_textbox" readonly="readonly" />

    <div class="file_input_div">
      <input type="button" value="Search files" class="file_input_button" />
      <input type="file" class="file_input_hidden" onchange="javascript: document.getElementsByName('fileName')[0].value = this.value" />
    </div>

it doesnt’t work woth error:
document.getElementsByName(…).0′ is null or not an object

  • 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-16T18:36:23+00:00Added an answer on June 16, 2026 at 6:36 pm

    When you add the runat="server" then the id and the name is rendered different and may change by asp.net

    To get the rendered name you use the UniqueID and get it as <%=fileName.UniqueID%>, so your code as it is must be done:

    <input runat="server" type="text" name="fileName" id="fileName" class="file_input_textbox" readonly="readonly" />
    
        <div class="file_input_div">
          <input type="button" value="Search files" class="file_input_button" />
          <input type="file" class="file_input_hidden" 
             onchange="javascript: document.getElementsByName('<%=fileName.UniqueID%>')[0].value = this.value" />
        </div>
    

    I verify it and thats the way, the name and ids change when this is added inside a master page. If they are alone on a page with out master page, then they stay as it is, but if you added them on a master page, they change and you need to get them by the rendered id.

    Note that the clientidmode="Static" on the input control is not working for the name but only for the id so if you add it and try to keep the id the same, then you must get your element by id and not by name.

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

Sidebar

Related Questions

This is my html code : <div id=d1 class=division> <input type=button value=one class=division> </div>
I have the following code: HTML <div id='foo'> <input type='checkbox' value='english' name='bar[english]' /> <input
HTML code: <div class=clearfix style=color: #555 style=display:block; > <input type=text id=id_site placeholder=nom-du-site style=width: 245px;
browsing some html code I find a text input coded as: <input type=text name=Email<%=orderRow.ID
I have this HTML code for radios: <input type='radio' name='a_27' value='Yes' id='a_27_0' /> <input
My HTML code goes like this: <div id=single><br><br> 1) effew<br> <input name=answer0 id=answer0 value=1
My HTML code: <p>NEWS</p> <p> <form action=news.php method=post> <center><input name=NEW type=submit id=new value=NEW/> <input
This is my html Code: <input type=checkbox name=test id=test /> Here i want to
I have below html code in my aspx. <input type=hidden id=medicalLink value='<a href=/forms/contactus.aspx >Contact
The code: HTML: <div id = LeftDiv> <p class = hdr>ADVANCED SEARCH:</p> <div class

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.