Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > Is it possible to get a control by ID like e.Item.Cells[1].Controls["toto"]

Reply
Thread Tools

Is it possible to get a control by ID like e.Item.Cells[1].Controls["toto"]

 
 
SoftLion
Guest
Posts: n/a
 
      05-06-2004
Is it possible to get a control by ID like that :

void DataGrid1_ValidateEdit(object sender, DataGridCommandEventArgs e)
{
object obj = e.Item.Cells[2].Controls["myControlID"];
instead of:
object obj = e.Item.Cells[2].Controls[0];
}

Or is there a way to do this easily ?


 
Reply With Quote
 
 
 
 
SoftLion
Guest
Posts: n/a
 
      05-06-2004
Ok I found the solution,
FindControl ....


 
Reply With Quote
 
 
 
 
George
Guest
Posts: n/a
 
      05-06-2004
Well,

i have never done it that way but I know this way works:

dim workDropDownList as dropdownlist

workDropDownList = CType(e.Item.FindControl("ddlDivision"),
DropDownList)




the point being the FindControl function will return a reference to
the control with the ID specified.

I hope this helps.
George
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
object-like macro used like function-like macro Patrick Kowalzick C++ 5 03-14-2006 03:30 PM
XML + XSD: Is it possible to get all possible Values for an Element? Markus Java 1 11-22-2005 02:51 PM
JDO Question : Is it possible to get unique values like DISTINCT in SQL? Klixx0r Java 1 12-08-2004 10:34 AM
Possible to create a composite control that has a child control that is a validator that validates the composite control itself? Jonathan Eric Miller ASP .Net Building Controls 2 07-22-2004 10:58 PM
Is it possible to create a custom web control like this? billym ASP .Net Web Controls 1 09-08-2003 04:24 AM



Advertisments