473,385 Members | 1,830 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,385 software developers and data experts.

Why the Id of the user control gets changed when used in aspx

Hi guys!!!!!!!!!
Can anyone help me out in this. I have .ascx file with one
textbox control in it. I am using it in my .aspx file. What happens is
i am giving the id of textbox control in ascx as ID="text1" when i try
to view the source once the page is loaded i can see the id as
"ctl4_text1". why is that. I need the Id because i need to do
validations for that control

can someone help me in this!!!!!!!!!!!

thanks
dharani pattabi
Nov 18 '05 #1
4 1231
Pattabi wrote:
Hi guys!!!!!!!!!
Can anyone help me out in this. I have .ascx file with one
textbox control in it. I am using it in my .aspx file. What happens is
i am giving the id of textbox control in ascx as ID="text1" when i try
to view the source once the page is loaded i can see the id as
"ctl4_text1". why is that. I need the Id because i need to do
validations for that control

can someone help me in this!!!!!!!!!!!

thanks
dharani pattabi


Pattabi,

would you be doing server or client side validation?

Jonel
Nov 18 '05 #2


Hi jonel,
thanks for immediate response. I need to do serverside valiation
using
validationcontrols
<asp:comparevalidator....requiredvalidator
since the id is changed during the load, the controls is not getting
validated.

waiting for your response

thanks
dharni

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #3
SF
Dharani,

the problem you are facing is that you have wrapped your text control in a
custom user control,
therefore the control gets renamed to "ctl4_text1", where ctl4 is the id of
your user control.
This is to allow for multiple instances of the same user control on the same
page without naming
collisions (since forms send back in http in key-value-pairs).

VS.Net does not support your approach and I haven't found a solution for
your problem.
I tried dynamically setting the controlToValidate in the validator, but it
only takes a string value
(otherwise you could have looked up the text control using FindControl())

Let me know if you found a solution
Good luck
Stefan

"Dharani Ravindran" <dp******@saipeople.com> wrote in message
news:OL**************@TK2MSFTNGP12.phx.gbl...


Hi jonel,
thanks for immediate response. I need to do serverside valiation
using
validationcontrols
<asp:comparevalidator....requiredvalidator
since the id is changed during the load, the controls is not getting
validated.

waiting for your response

thanks
dharni

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 18 '05 #4
SF
Dharani,

the problem you are facing is that you have wrapped your text control in a
custom user control,
therefore the control gets renamed to "ctl4_text1", where ctl4 is the id of
your user control.
This is to allow for multiple instances of the same user control on the same
page without naming
collisions (since forms send back in http in key-value-pairs).

VS.Net does not support your approach and I haven't found a solution for
your problem.
I tried dynamically setting the controlToValidate in the validator, but it
only takes a string value
(otherwise you could have looked up the text control using FindControl())

Let me know if you found a solution
Good luck
Stefan

"Dharani Ravindran" <dp******@saipeople.com> wrote in message
news:OL**************@TK2MSFTNGP12.phx.gbl...


Hi jonel,
thanks for immediate response. I need to do serverside valiation
using
validationcontrols
<asp:comparevalidator....requiredvalidator
since the id is changed during the load, the controls is not getting
validated.

waiting for your response

thanks
dharni

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 18 '05 #5

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

Similar topics

5
by: V. Jenks | last post by:
Long story as short as possible: I have a page (aspx) that contains a user control (ascx). In the form the user can enter a username and password. If they do, the password box auto-posts-back...
6
by: grist2mill | last post by:
I want to create a standard tool bar that appears on all pages that is a control. The toolbar has a button 'New'. What I wolud like when the user clicks on 'New' depends on the page they are on. I...
5
by: Simon Harris | last post by:
Hi All, I am trying to call a method in a web form, from an event fired in a user control. My user control displays a map, which has a link button to enlarge/shrink the map. When the user...
7
by: Daniel Walzenbach | last post by:
Hello, I want to create a Word XML file based on the input users make in a VB.NET application. I imagine creating a template in Word and saving it as a XML file. I then want to fill the...
2
by: Mike | last post by:
Hi, I am strugling with a simple problem which I can't seem to resolve. I have an asp.net page which contains a server-control (flytreeview, which is a kind of a tree to be exact). The tree is...
11
by: John J. Hughes II | last post by:
I have a DataGridView displaying data from a DataSet. To the right of that I have a custom user control which displays one of the data set fields. The custom user control is bound to the data set...
9
by: Gummy | last post by:
Hello, I created a user control that has a ListBox and a RadioButtonList (and other stuff). The idea is that I put the user control on the ASPX page multiple times and each user control will...
5
by: rn5a | last post by:
Consider the following user control which resides in Address.ascx: <script runat="server"> Public Property Address() As String Get Address = txtAddress.Text End Get Set(ByVal value As String)...
4
by: archana | last post by:
Hi all, i am having one user control. what i want is to add javascript which will gets called on button click of user control. but user control is not working if i add javascript in user...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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...

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.