Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / July 2007

Tip: Looking for answers? Try searching our database.

DataGridView Question

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
S Chapman - 25 Jul 2007 09:55 GMT
I have a DataGridView on my page that uses Template Fields for some of
the cells. One such cell has a DropDownList as a control on the
EditItemTemplate. The user using a button on the page can add items to
this drop down. I am unable to get a reference to this drop down list
on the "template" so that I can add the new item to the list.

I am able to however get a reference to specific row-wise instances of
the DropDownList using:

_grdMain.Rows[nIndex].FindControl("_cmbList")

Do I have to add items to these individual controls or is it possible
to obtain a reference to the template control itself and add the item
only once? Thanks.
Mark Rae [MVP] - 25 Jul 2007 10:16 GMT
>I have a DataGridView on my page

Do you mean a DataGrid or a GridView...?

Signature

Mark Rae
ASP.NET MVP
http://www.markrae.net

S Chapman - 25 Jul 2007 10:26 GMT
Sorry I meant {System.Web.UI.WebControls.GridView}
Eliyahu Goldin - 25 Jul 2007 10:49 GMT
In theory, you can use LoadTemplate method to operate on templates in run
time. Google for it for more info. I just think it will be much easier to
add items to the ddl in every row.

Signature

Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net

>I have a DataGridView on my page that uses Template Fields for some of
> the cells. One such cell has a DropDownList as a control on the
[quoted text clipped - 10 lines]
> to obtain a reference to the template control itself and add the item
> only once? Thanks.
Mridul - 25 Jul 2007 12:35 GMT
I think instead of trying to add item to DropDownList, you can add
item to data source of DropDownList.
This step will automatically add item to DropDownList and you don't
need any reference of DropDownList.

Thanks!

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.