Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 4th, 2004, 11:45 AM
Authorized User
 
Join Date: Jun 2004
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Raif
Default switch of the edit in templatecolumn?

Is there a way to switch on and off the edititem part of a itemtemplatecolumn in a datagrid based on what the origonal value of the cell is?

In other words I have a column and when you click edit it becomes a dropdownlist. but if the origional value of the cell is " don't mess with this cell" then I wan't to disable that dropdown list. but there are other columns in the row that would need editing so I can't just disable the edit.

Thanks
Raif

 
Old August 4th, 2004, 12:05 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hey,

You can switch on and off the edit part of the column as you specified, but to do what you want to do, I don't know. You can access an entire column through the DataGrid.Columns collection, which allows you to set visibility. In addition, to access a specific row, use DataGrid.Items(index) to access the items in a DataGrid. JavaScript may be a need for this to work also.

Brian
 
Old August 4th, 2004, 12:06 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Oh also, for controls in a datagrid, use findcontrol, as such:

DataGrid.Items(0).Cells(0).FindControl("controlnam e")
 
Old August 4th, 2004, 12:10 PM
Authorized User
 
Join Date: Jun 2004
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Raif
Default

Ok, that's cool, I could probably just switch off visibily so you couldn't see the ddl but I would need to use an if than statment to determin whether to turn it on or off. Is there a way to do this in a datagrid? that is since my ddl is called in the html I don't know how to use a logical statment.
Thanks for the help
Raif

 
Old August 4th, 2004, 02:08 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

You will need to utilize the ItemDataBound event of the datagrid to manipulate particular cells of a particular row (datagriditem) in the datagrid. Do a search for "ItemDataBound" on this forum, there are several threads addressing this type of technique.
 
Old August 4th, 2004, 03:51 PM
Authorized User
 
Join Date: Jun 2004
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Raif
Default

Great that worked. Thanks for the help!
Raif






Similar Threads
Thread Thread Starter Forum Replies Last Post
populate a DropDownList in a TemplateColumn of a G aidoco ASP.NET 1.0 and 1.1 Basics 0 October 13th, 2006 08:31 AM
Datagrid Templatecolumn with Hyperlink ~Bean~ ASP.NET 1.0 and 1.1 Basics 0 July 18th, 2005 10:02 AM
TemplateColumn - Question vox Classic ASP Professional 1 June 6th, 2005 07:18 AM
Right align text in labels in a templatecolumn texasraven ASP.NET 1.x and 2.0 Application Design 1 August 27th, 2003 08:44 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.