473,385 Members | 1,693 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.

javascript bafflement in datagrid

Hi folks, I'm using ASP.net with Framework 1.1 and C#

to go into my actual problem and fully explain would take more than any of
us could take (me writing it, you reading it)

however I can boil down one baffling aspect into a nutshell

I know about getElementById(' ') and it takes the literal id of a control,
or a variable with that value in it. I also know that you can get all
elements that are of a certain type using a wildcard...

what would be great is if you can give a wildcard to the getElementById
method

the reason being that the textbox I want to write back to in the grid is
called txtUserId in the declarative HTML , but DGMappings_ctl4_txtuserId on
the actual page

the 4 being the 3 rd of the datagrid...

so any wildcard ways of getting an element by ID or any suggested workarounds?

Regards and thanks in advance
CharlesA
Mar 27 '06 #1
6 1508
Is there only one txtUserId on the page?

Eliyahu

"CharlesA" <Ch******@discussions.microsoft.com> wrote in message
news:88**********************************@microsof t.com...
Hi folks, I'm using ASP.net with Framework 1.1 and C#

to go into my actual problem and fully explain would take more than any of
us could take (me writing it, you reading it)

however I can boil down one baffling aspect into a nutshell

I know about getElementById(' ') and it takes the literal id of a control,
or a variable with that value in it. I also know that you can get all
elements that are of a certain type using a wildcard...

what would be great is if you can give a wildcard to the getElementById
method

the reason being that the textbox I want to write back to in the grid is
called txtUserId in the declarative HTML , but DGMappings_ctl4_txtuserId
on
the actual page

the 4 being the 3 rd of the datagrid...

so any wildcard ways of getting an element by ID or any suggested
workarounds?

Regards and thanks in advance
CharlesA

Mar 27 '06 #2


Hi Eliyahu,
there should be, but because it's in the datagrid it has the format

DatagridName__ctlRowcount_txtUserId

when you go into Editmode

Cheers
CharlesA


Mar 27 '06 #3
If you emit your javascript into the page server-side
("RegisterClientScriptBlock")
you can use the Control.UniqueId property to have the javascript
specifically look for the "DGMappings_ctl4_txtuserId "
unique id client-side.

Peter
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"CharlesA" wrote:
Hi folks, I'm using ASP.net with Framework 1.1 and C#

to go into my actual problem and fully explain would take more than any of
us could take (me writing it, you reading it)

however I can boil down one baffling aspect into a nutshell

I know about getElementById(' ') and it takes the literal id of a control,
or a variable with that value in it. I also know that you can get all
elements that are of a certain type using a wildcard...

what would be great is if you can give a wildcard to the getElementById
method

the reason being that the textbox I want to write back to in the grid is
called txtUserId in the declarative HTML , but DGMappings_ctl4_txtuserId on
the actual page

the 4 being the 3 rd of the datagrid...

so any wildcard ways of getting an element by ID or any suggested workarounds?

Regards and thanks in advance
CharlesA

Mar 27 '06 #4
Thanks peter but UniqueID does not return the

Datagrid__ctlx_txtUserId naming format that the renderer uses

it returns just txtUserId
Regards
CharlesA
Mar 27 '06 #5
ClientID should do.

Eliyahu

"CharlesA" <Ch******@discussions.microsoft.com> wrote in message
news:80**********************************@microsof t.com...
Thanks peter but UniqueID does not return the

Datagrid__ctlx_txtUserId naming format that the renderer uses

it returns just txtUserId
Regards
CharlesA

Mar 27 '06 #6
Exactly! ClientId. :-)

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Eliyahu Goldin" wrote:
ClientID should do.

Eliyahu

"CharlesA" <Ch******@discussions.microsoft.com> wrote in message
news:80**********************************@microsof t.com...
Thanks peter but UniqueID does not return the

Datagrid__ctlx_txtUserId naming format that the renderer uses

it returns just txtUserId
Regards
CharlesA


Mar 27 '06 #7

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

Similar topics

1
by: Darko³ | last post by:
In my web aplication I recover a list of members from a DataGrid. A colum of the DataGrid is a TemplateColumn that call a javascript function that ask to the client a confirm (a simple pop up) and...
2
by: Alex | last post by:
Hi all, I'm writing a small web application which searches a database based on a date field, and populates a datagrid control with the results. The datagrid control has selection buttons added...
2
by: john | last post by:
I posted this question to comp.lang.javascript but didn't get a response, so I'll try here. I am using ASP.NET and I have a datagrid. One of the columns in my grid is all checkboxes. When the...
2
by: Bruce W.1 | last post by:
There's something I can't figure out. I added some javascript behavior to my datagrid, just like in this article, except in C# instead of VB: ...
2
by: Luis Esteban Valencia Muñoz | last post by:
I have a datagrid that displays editable text fields (2 different price fields) and a checkbox in every row. It has a "SaveChanges" button at the bottom, which, when pressed, looks at every...
2
by: Tim::.. | last post by:
Hi I'm trying to create a little application that shows an image of a user when you mouseover there details in a datagrid. The datagrid is populated from an Active Directory Database and I...
3
by: Lyners | last post by:
I have a table within a cell of a datagrid. I am doing updates without postback to the server using Javascript. I have everything working, except referencing a table within the datagrid cell. ...
7
by: julian.tklim | last post by:
Hi, I need to build an editable Datagrid with add & delete buttons on each row using javascript. DataGrid need not be pre-populated with values. To make the thing complicated, one of the...
1
by: KRISHNA PRAVI | last post by:
the error is "runtime error object expected" here is the code....................................................................................... <script language="javascript"...
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: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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.