473,396 Members | 1,789 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

ascx changes input id

When using an ascx page, I use a textbox input as follows:

<asp:TextBox id="txtDate" runat="server" Width="130px"></asp:TextBox>

I want to use javascript to access this textbox, but when it posts to a browser, it gives some wierd id to the textbox, like:

<input name="_ctl0:txtDate" type="text" id="_ctl0_txtDate" style="width:130px;" />

So is there anyway to access this field from javascript?

Thanks,

Leon.

---
Posted using Wimdows.net Newsgroups - http://www.wimdows.net/newsgroups/
Nov 28 '05 #1
1 1087
This is so that if you have 2 of the user control on a page, that all the
HTML elements still have unique ID's.

So, you should use the ClientID property on the server side to get this
name.You then might have to emit it into your javascript in the right spots,
in order to be able to use it.

"Leon Chuck Gosslin" <powerb@-NOSPAM-inel.gov> wrote in message
news:u6*************@TK2MSFTNGP09.phx.gbl...
When using an ascx page, I use a textbox input as follows:

<asp:TextBox id="txtDate" runat="server" Width="130px"></asp:TextBox>

I want to use javascript to access this textbox, but when it posts to a
browser, it gives some wierd id to the textbox, like:

<input name="_ctl0:txtDate" type="text" id="_ctl0_txtDate"
style="width:130px;" />

So is there anyway to access this field from javascript?

Thanks,

Leon.

---
Posted using Wimdows.net Newsgroups - http://www.wimdows.net/newsgroups/

Nov 28 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: kbailey | last post by:
what a waste of money. visual studio does not handle user control files - these are files with and ascx extension are are refered to in the help as 'user-authored server controls'. the VS...
11
by: Peter Wu | last post by:
Hello, I want to create a Header and Footer for every ASPX page I build. I created 2 Web user controls respectively and placed them in an ASPX page. The problem is that I cannot position the...
0
by: Ryan Knopp | last post by:
I have created this header file (ascx) that dynamically changes depending on the page it's on. I would like to keep this file in one location so I can change my menus at one place without having to...
0
by: Francis | last post by:
Hi all, I am writing a .cs component that sets RegisterHiddenField on the server side and generates javascript to execute on the client side. It works when the component is directly in the...
5
by: djscratchnsniffing | last post by:
i know you can access an ascx's properties/methods from an aspx file. Let's say you have an aspx file with two code-behind files(ascx files). Can you access one of the ascx file's...
4
by: ChrisB | last post by:
Hi - I'm just trying to figure out what would be involved with deploying a simple HTML update to an ASCX file. Where there were no changes to the code behind (compiled code), to deploy this to...
1
by: John | last post by:
Hi, I've decided to try to reduce duplicate code and simplify a seriously complicated page I have by using web user controls. My problem is; one of the controls contained within my new ascx,...
1
by: sk | last post by:
hello , this is sk, new to this group problem>>>> i have a .ascx file any changes done to this file do not get mapped it does not throw any errors but the compiler executes the code that was...
2
by: krallabandi | last post by:
I have a hidden control <input id="FieldSortOrder" type="hidden" name="FieldSortOrder" runat="server"> in a ascx page. I want to store some value in this control in the code behind page. ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.