473,598 Members | 2,916 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1242
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
validationcontr ols
<asp:compareval idator....requi redvalidator
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 controlToValida te 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******@saipe ople.com> wrote in message
news:OL******** ******@TK2MSFTN GP12.phx.gbl...


Hi jonel,
thanks for immediate response. I need to do serverside valiation
using
validationcontr ols
<asp:compareval idator....requi redvalidator
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 controlToValida te 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******@saipe ople.com> wrote in message
news:OL******** ******@TK2MSFTN GP12.phx.gbl...


Hi jonel,
thanks for immediate response. I need to do serverside valiation
using
validationcontr ols
<asp:compareval idator....requi redvalidator
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
2057
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 and checks to see if the user already exists in the database. If yes, the rest of the form fields on the page are populated with that existing user's data.
6
12270
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 would like to do this by defining a NewFunc() that is different in each (code-behind) page which is called by the standard 'New' button in the toolbar. How can I get this to work? So far I have the following (which doesnt work). When the user...
5
2447
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 enlarges the map, I want to hide my navigation table etc, maximising the viewing area. I've been working on this for 5 hours now, so far I have as detailed below - Which rund with out error, but the final function never gets called. Any help/suggestions...
7
4988
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 template (in my application) based on the user input. When the document gets opened there should be fields users can change but others should be prevented from beeing changed (I know that an "open" file format like XML can always be modified to allow...
2
4911
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 being updated by some other process through remoting. When the page loads, I init the tree, and in my browser I can see the initialized tree. The problem is that every time that I receive update to tree from the remote process,
11
11558
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 object and displays the data correctly when I move from row to row. The problem I am having is the data set always reads the data back and considers it change even when it's not. I am looking for how to change the following code so the...
9
3176
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 load with different data (locations, departments, etc.).
5
2153
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) txtAddress.Text = value End Set
4
4233
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 control.. but if i add javascript in page in which i am adding user control then that javascript is executed properly. i tested by displaying alert message in javascript. can anyone tell
0
7894
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8284
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
6711
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5847
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5437
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3894
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3938
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1500
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1245
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.