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

Sometimes _ctl0_btnNew Sometimes _ctl1_btnNew?

bg
hello,
in my web project, i used placeholder and dynamically I place ascx controls
in it.
in ascx file, i want to delete,update,create to DB. Then i used to ASP
buttons to do this.

My problem is, id's of buttons can change. E.g. id of button is btnNew, in
one load - when I look source of html page - the id is _ctl0_btnNew , in
another _ctl1_btnNew.

1. Why this prefixes added to ids?
2. How can i handle button ids truly?

thanks

Numan
Nov 18 '05 #1
4 1089
Why do you care?

--
Girish Bharadwaj
http://msmvps.com/gbvb

hello,
in my web project, i used placeholder and dynamically I place ascx
controls
in it.
in ascx file, i want to delete,update,create to DB. Then i used to ASP
buttons to do this.
My problem is, id's of buttons can change. E.g. id of button is
btnNew, in one load - when I look source of html page - the id is
_ctl0_btnNew , in another _ctl1_btnNew.

1. Why this prefixes added to ids?
2. How can i handle button ids truly?
thanks

Numan


Nov 18 '05 #2
bg
I use some special jscript validation formulas. In these jscript functions,
how can i obtain buttons. I want enable-disable buttons, change text...
Because of changing id's of buttons, i can not handle buttons.

Can You answer my questions before?
Thanks
Numan

"Girish bharadwaj" <gi*****@mvps.org> wrote in message
news:eJ**************@tk2msftngp13.phx.gbl...
Why do you care?

--
Girish Bharadwaj
http://msmvps.com/gbvb

Nov 18 '05 #3
"bg" <bg@hn> wrote in news:e7**************@TK2MSFTNGP15.phx.gbl:
I use some special jscript validation formulas. In these jscript
functions, how can i obtain buttons. I want enable-disable
buttons, change text... Because of changing id's of buttons, i
can not handle buttons.


Numan,

ASP.Net dynamically creates an ID for a control because multiple
instances of that control may exist on a page. For example, let's
say you have a user control (.ascx) with a button on it named
"btnNew". If you have a page (.aspx) with three instances of that
user control on it, ASP.Net will dynamically assign IDs to those
three buttons when it generates the HTML, something like
"_ctrl0_btnNew", "_ctrl1_btnNew", and "_ctrl2_btnNew".

You can get the dynamically generated control name in server-side
code by reading the control's ClientId property.

--
Hope this helps.

Chris.
-------------
C.R. Timmons Consulting, Inc.
http://www.crtimmonsinc.com/
Nov 18 '05 #4
bg
it is ok. thanks Chris

"Chris R. Timmons" <crtimmons@X_NOSPAM_Xcrtimmonsinc.com> wrote in message
news:Xn**********************************@207.46.2 48.16...
"bg" <bg@hn> wrote in news:e7**************@TK2MSFTNGP15.phx.gbl:
I use some special jscript validation formulas. In these jscript
functions, how can i obtain buttons. I want enable-disable
buttons, change text... Because of changing id's of buttons, i
can not handle buttons.


Numan,

ASP.Net dynamically creates an ID for a control because multiple
instances of that control may exist on a page. For example, let's
say you have a user control (.ascx) with a button on it named
"btnNew". If you have a page (.aspx) with three instances of that
user control on it, ASP.Net will dynamically assign IDs to those
three buttons when it generates the HTML, something like
"_ctrl0_btnNew", "_ctrl1_btnNew", and "_ctrl2_btnNew".

You can get the dynamically generated control name in server-side
code by reading the control's ClientId property.

--
Hope this helps.

Chris.
-------------
C.R. Timmons Consulting, Inc.
http://www.crtimmonsinc.com/

Nov 18 '05 #5

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

Similar topics

0
by: svend | last post by:
Hey everyone, this is my first messege to this group, so I hope it's fitting. I've been messing with time alot recently, particularly time formatting. During that, I've observed, that when...
3
by: Andrew DeFaria | last post by:
I have the following php code: function Today2SQLDatetime () { $today = date ("Y-m-d H:i:s"); print "date (\"Y-m-d H:i:s\") returned $today<br>"; return $today; return date ("Y-m-d H:i:s"); }...
6
by: Stephane Dalpe | last post by:
Hi all, I just want to know why when I'm installing jdk sometimes ask me to reboot and sometimes he don't. As part of our installation, we launch the jdk installation if it's not already...
0
by: J.Bijleveld | last post by:
Hello colleagues, At this moment we have a real big problem using a .NET application with an Oracle database (v8.1.6). I hope someone has encountered this problem before and is able to help me...
2
by: J.Bijleveld | last post by:
Hello colleagues, At this moment we have a real big problem using a .NET application with an Oracle database (v8.1.6). I hope someone has encountered this problem before and is able to help me...
2
by: Kamyk | last post by:
Hello all! Could you tell me where is the error on the below code, because the script is sometimes working correctly and sometimes is not working correctly. I want my new window with picture...
4
by: Resant | last post by:
I have a scheduled job contain 2 steps. Step 1 is execute DTS Package using CmdExec 'DTSRun', step 2 using TSQL to execute just simple query. This job execute recurely every day, every 6 hours....
9
by: CeyloR | last post by:
Hello everyone, I have a problem with my Ajax page. I'm jusing prototype-1.4.0.js as framework. I have a function to populate three listboxes. The items in the listboxes are from a MYSQL...
9
by: Eric Falsken | last post by:
I've added a number of additional properties to my profile. Sometimes, the values are populated when the user is retrieved from the database, but sometimes the values are empty/default. How can I...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...

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.