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

Why do webcontol ID's change

I have a lable control in a repeater and 2 link buttons. The lable is named
lblCurrentPage and the link buttons are named "Prev" and "Next". Once the
page is uploaded and viewed through the browser, all three button id's
change. Why is this? I see it has been changed by looking at the source of
the web page. I thnk this may be causing a problem in my code because I'm
refrencing the controls by the id name I gave them. Is there a way to keep
these controls from being renamed?
Mar 12 '07 #1
3 1187
It seems you are trying to access your controls from client side. to be able
to do so, use ClientID property of your server control to access the client
reference.
you client code might contain something similar to this
var value = document.getElementById("<%=txtBx.ClientID%>").val ue
--
Muhammad Mosa
Software Engineer & Solution Developer
MCT/MCSD.NET
MCTS: .Net 2.0 Web Applications
MCTS: .Net 2.0 Windows Applications
MCPD: .Net 2.0 Enterprise Application Developer
"Erica" wrote:
I have a lable control in a repeater and 2 link buttons. The lable is named
lblCurrentPage and the link buttons are named "Prev" and "Next". Once the
page is uploaded and viewed through the browser, all three button id's
change. Why is this? I see it has been changed by looking at the source of
the web page. I thnk this may be causing a problem in my code because I'm
refrencing the controls by the id name I gave them. Is there a way to keep
these controls from being renamed?
Mar 13 '07 #2
Muhammad,
thank you for your help. I didn't even think about that. As a workaround I
just took the controls out of the repeater and referenced them in the code
behind the normal way: thecontolname.text

Thanks again. I'll know next time what to do right away.

"Muhammad Mosa" wrote:
It seems you are trying to access your controls from client side. to be able
to do so, use ClientID property of your server control to access the client
reference.
you client code might contain something similar to this
var value = document.getElementById("<%=txtBx.ClientID%>").val ue
--
Muhammad Mosa
Software Engineer & Solution Developer
MCT/MCSD.NET
MCTS: .Net 2.0 Web Applications
MCTS: .Net 2.0 Windows Applications
MCPD: .Net 2.0 Enterprise Application Developer
"Erica" wrote:
I have a lable control in a repeater and 2 link buttons. The lable is named
lblCurrentPage and the link buttons are named "Prev" and "Next". Once the
page is uploaded and viewed through the browser, all three button id's
change. Why is this? I see it has been changed by looking at the source of
the web page. I thnk this may be causing a problem in my code because I'm
refrencing the controls by the id name I gave them. Is there a way to keep
these controls from being renamed?
Mar 13 '07 #3
// Make a note that the ClientID property is useless when trying to
reference
// DataList list items required to be used in the SideBar of the 2.0 Wizard.
// Each list item's ClientID value is named "SideBarButton" as shown...
_SideBarList_ctl01_SideBarButton.

// When the DataList has three list items the control tree will look like
this...
_SideBarList_ctl00_SideBarButton.
_SideBarList_ctl01_SideBarButton.
_SideBarList_ctl02_SideBarButton.

// The 2.0 Wizard's DataList requires objects which inherit from
// IButtonControl. The values of these ctl properties are generated by
// the compiler. Any other objects created in the page may and do cause
// different values for the ctl objects each time the page is compiled.
// Thus, referencing the value of ctl is not reliable.
//
// We can however reliably reference the 2.0 Wizard control's
// SideBar DataList list item's Title property that is rendered as
// the title attribute of the HTML anchor. This is the same value
// that is displayed as the ToolTip.

<%= Clinton Gallagher
NET csgallagher AT metromilwaukee.com
URL http://clintongallagher.metromilwaukee.com/
"Erica" <Er***@discussions.microsoft.comwrote in message
news:8A**********************************@microsof t.com...
Muhammad,
thank you for your help. I didn't even think about that. As a workaround I
just took the controls out of the repeater and referenced them in the code
behind the normal way: thecontolname.text

Thanks again. I'll know next time what to do right away.

"Muhammad Mosa" wrote:
>It seems you are trying to access your controls from client side. to be
able
to do so, use ClientID property of your server control to access the
client
reference.
you client code might contain something similar to this
var value = document.getElementById("<%=txtBx.ClientID%>").val ue
--
Muhammad Mosa
Software Engineer & Solution Developer
MCT/MCSD.NET
MCTS: .Net 2.0 Web Applications
MCTS: .Net 2.0 Windows Applications
MCPD: .Net 2.0 Enterprise Application Developer
"Erica" wrote:
I have a lable control in a repeater and 2 link buttons. The lable is
named
lblCurrentPage and the link buttons are named "Prev" and "Next". Once
the
page is uploaded and viewed through the browser, all three button id's
change. Why is this? I see it has been changed by looking at the source
of
the web page. I thnk this may be causing a problem in my code because
I'm
refrencing the controls by the id name I gave them. Is there a way to
keep
these controls from being renamed?

Mar 14 '07 #4

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

Similar topics

4
by: Neal | last post by:
I just did my first PHP/MySQL database (a simple survey) that works fine. It is ordered by an id field that auto increments. Apparently, one entry repeated (I'm thinking the user hit the submit...
6
by: PG | last post by:
When deleting a row from the database, that id is now missing. So what I'm trying to do is update in a loop (maybe an sql loop if there is one) of all of the id numbers - sort of like renaming...
3
by: CES | last post by:
All, Is their a way of iterating thru each tag within a form and returning the value given in the id property, by that I mean the below html would return the values idBoxOne, idBoxTwo,...
4
by: deko | last post by:
I use named anchors to take users to specific parts of a long page. But I want to add some processing and do some things with my nav bar when users go to certain sections delineated by named...
2
by: RWC | last post by:
Hello, I have a page connected to an SQL table. The page loops through, creating a row for each record, displaying in image, the ID of which is set to the record id. When I click a button to...
6
by: Luca | last post by:
Hi everyone, I'm super-newbie here... so thanx in advance for any help I shoud give a "value" to an DIV's ID that change following the name of the directory where the file is. For example the...
28
by: Matuag | last post by:
How can we create a unique and non-editable ID from client's first and last name? eg.: SmitJ1 for John Smith Matuag
1
by: chandan | last post by:
Hi! Can I manipulate the width/Height of scroll bar on asp Panel webcontol? Thanks, Chandan
6
by: AAaron123 | last post by:
I'm using the CreateUserWizard Web Server Control The error message when the passwords do not match is colored red. Red does not show well against my background so I like to change that color. I...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
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: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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...

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.