473,403 Members | 2,338 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,403 software developers and data experts.

can't get clientid of .net label in a JS file

I have an asp:label with an id='qty' inside a GridView.

I'm wanting to get the proper ClientID of it inside a JS file so I
can assign a value to it.

I can successfully do it manually by viewing the rendered page source
which shows it as 'GridView1_ctl02_qty' and then constructing the
following
document.getElementById("GridView1_ctl02_qty").inn erText = " ( " +
mySplitResult[0] + " )"
But I can't get the server rendering of the label ID by requesting it
in the js
file.. I've tried several variations.....
var idd1=document.getElementById('<%=GridView1.qty.Cli entID%>')
var idd2=document.getElementById('<
%=GridView1.FindControl("qty").ClientID%>');
var idd3=document.getElementById('<%=qty.ClientID%>')
var idd4=document.getElementById('<%=GridView1$qty.Cli entID%>')
I can though assign a value to a text box right beside the same label
contol ie.. < input type ="text" id="qtyy">
and not have to get the server id rendering as below works fine

document.getElementById("qtyy").value = " ( " + mySplitResult[0] +
" )"
can someone point out my error.. or where I need to look
thanks
Oct 25 '08 #1
2 3767
Deere wrote:
I have an asp:label with an id='qty' inside a GridView.

I'm wanting to get the proper ClientID of it inside a JS file so I
can assign a value to it.
[...]
I've tried several variations.....
var idd1=document.getElementById('<%=GridView1.qty.Cli entID%>')
[...]
can someone point out my error.. or where I need to look
You need to look at the *generated*, *client-side* source code.
PointedEars
--
var bugRiddenCrashPronePieceOfJunk = (
navigator.userAgent.indexOf('MSIE 5') != -1
&& navigator.userAgent.indexOf('Mac') != -1
) // Plone, register_function.js:16
Oct 26 '08 #2
On Oct 26, 6:49*am, Thomas 'PointedEars' Lahn <PointedE...@web.de>
wrote:
You need to look at the *generated*, *client-side* source code.

PointedEars
I did ie..."I can successfully do it manually by viewing the rendered
page source
which shows it as 'GridView1_ctl02_qty' and then constructing the
following.... "

Since the label is in gridview I need to assign a value dynamicly as
I dont know what gridview row will be clicked.

thanks
mark
Oct 28 '08 #3

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

Similar topics

3
by: Dude | last post by:
Below is the code - it is finding the control, and there is no error, just not assigning the text to the label <asp:DataList id="dlGoals" runat="server" onEditCommand="myListEditHandler"...
1
by: bill yeager | last post by:
I did some more debugging and found the following: 1) I placed the following code in the button event just to see if I could cycle thru the datagrid control collection: <code> Dim strhello As...
2
by: Henri | last post by:
Sorry to post so many questions but if you could tell me the difference between these 3 IDs, it would help me a lot. I don't know which one to use inside my custom control...
0
by: Vikram | last post by:
is someone has faced this kind of problem... I am using clientid porperty of server control in this manner in a javascript alert('<%=txt.clientid%>') now first time it give some spaces in the...
0
by: sudhashekhar30 | last post by:
hi i m trying to set text property of label which is in content page from javascript function. function empcodesize() { var size=document.getElementById('<%=TxtempCode.ClientID...
8
by: SagarDoke | last post by:
I have written one code for combobox in html. <label style="margin-left:450px" for="clientName">Client Name:</label> <Select style="margin-left:31px" name="clientName" id="clientName" onchange...
9
by: Matthew Wells | last post by:
OK, I've narrowed down the problem. This works when in the aspx page <script type="text/javascript" > function btnFirst_Click() { alert("Hello");...
2
by: nja2222 | last post by:
I would like to create a page for my clients to login and check for updates on their accounts. Then I would like to create a page where my employees can login and make updates, specifically new file...
7
by: imbirek8 | last post by:
Hi! I would like to write something in Javascript to HiddenField: <asp:HiddenField ID="hiddenMy" runat="server" Value="" /> And in the code behind read this value. But this HiddenField is in...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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?
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...
0
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,...
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
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...

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.