Home All Groups Group Topic Archive Search About

Help needed with DataGrid Client-Side Scripting

Author
4 Mar 2005 5:12 PM
Subba Rao via DotNetMonster.com
Hi,

  I have a custom ASP.Net DataGrid Control which has DropDownLists in each
of the HeaderCells of the Grid. I'm not able to get the ClientID that is
automatically assigned to the DropDownLists. I need help. Please send your
suggessions ASAP

--
Message posted via http://www.dotnetmonster.com

Author
4 Mar 2005 5:42 PM
news.microsoft.com
You can either do it in a hard way or and easier way. The hard way is to get
ClientID in ItemDataBind event followed by Page.RegisterArrayDeclaration()
to pass them to the client.... I have tested this logic yet and I think it
should work.
The easy way is, MS names the clientIDs for those DDLs in a very consistent
manner. Compile and run your application without any JS, then view the html
source and you will find out how MS names those clientIDs. I use this in my
applicaiton and it works very well.
Here is one thing I need to make a note: Asp.net won't be able to "remember"
the ddlselection changes so you cannot get DDL's updated selection by using
DDL.SelectedValue or DDL.SelectedIndex property on server side. What I did
was to use HiddenFields to carry those updated values.

Hope it helps.

Show quoteHide quote
"Subba Rao via DotNetMonster.com" <fo***@DotNetMonster.com> wrote in message
news:0eaa0c973a99405f809d74452313ba0b@DotNetMonster.com...
> Hi,
>
>   I have a custom ASP.Net DataGrid Control which has DropDownLists in each
> of the HeaderCells of the Grid. I'm not able to get the ClientID that is
> automatically assigned to the DropDownLists. I need help. Please send your
> suggessions ASAP
>
> --
> Message posted via http://www.dotnetmonster.com
Author
10 Mar 2005 4:42 PM
Subba Rao via DotNetMonster.com
Thank you for replying. I solved the issue, the ClientID of the dropdown
list gave me the ID of the dropdown list on the Grid Headers. Thanks alot.

--
Message posted via http://www.dotnetmonster.com