Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > datagrid checkbox list edit item not working

Reply
Thread Tools

datagrid checkbox list edit item not working

 
 
cindy
Guest
Posts: n/a
 
      10-18-2005
I am using asp template columns. I display box values from a lookup table.
The datagrid displays field "bookid" and the checkbox displays "category"
field for the book. The category field is a string concatenation of category
values such as CT,MR,NM or just CT
When the grid goes into edit mode I use the itemdatabound to determine
whether to set checkbox as selected based on the value of the category field.
((CheckBoxList)e.Item.Cells[0].FindControl("cbl1")).SelectedValue =
ds.Tables[0].Rows[cnt]["Category"].ToString();
Ok if category = CT How do I get an array into the itemdatabound with comma
delimiter so CT,MR for example will see values as CT and a MR:
The update command for the grid builds the string by looping thru the
selected values from the checkbox. Am I completely missing a better way?
--
cindy
 
Reply With Quote
 
 
 
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      10-19-2005
Hi Cindy,

Welcome to ASPNET newsgroup.
As for the problem you mentioned, I think your current approach on using
the DataGrid's ItemDatabound event is reasonable since we need to do some
complex data maniplating and bind to CheckBoxList. As for the string
concatenation data field, I think you can use the .NET string class's
"Split" and "Join" method which can help divide concatenation string into
string[] array or combine string[] array into single string (by specific
separator chars).

Hope helps. thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)







--------------------
| Thread-Topic: datagrid checkbox list edit item not working
| thread-index: AcXUG8IE1CTNsUFCSb6nXy/kzi2d/Q==
| X-WBNR-Posting-Host: 71.136.160.120
| From: "=?Utf-8?B?Y2luZHk=?=" <>
| Subject: datagrid checkbox list edit item not working
| Date: Tue, 18 Oct 2005 12:40:13 -0700
| Lines: 14
| Message-ID: <14E27119-5229-41A3-89B3->
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.public.dotnet.framework.aspnet.datagridc ontrol
| NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA02.phx.gbl!TK2MSF TNGXA03.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet.datagridc ontrol:5812
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.datagridc ontrol
|
| I am using asp template columns. I display box values from a lookup
table.
| The datagrid displays field "bookid" and the checkbox displays "category"
| field for the book. The category field is a string concatenation of
category
| values such as CT,MR,NM or just CT
| When the grid goes into edit mode I use the itemdatabound to determine
| whether to set checkbox as selected based on the value of the category
field.
| ((CheckBoxList)e.Item.Cells[0].FindControl("cbl1")).SelectedValue =
| ds.Tables[0].Rows[cnt]["Category"].ToString();
| Ok if category = CT How do I get an array into the itemdatabound with
comma
| delimiter so CT,MR for example will see values as CT and a MR:
| The update command for the grid builds the string by looping thru the
| selected values from the checkbox. Am I completely missing a better way?
| --
| cindy
|

 
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
ASP.Net 2.0 Insert new item, then display this new item in Edit mo Ann ASP .Net Web Controls 0 03-28-2007 01:11 AM
Snapshot restraint - edit, edit, edit Alan Browne Digital Photography 24 05-10-2005 10:15 PM
Snapshot restraint - edit, edit, edit Patrick Digital Photography 0 05-06-2005 10:53 PM
Edit All Function for DataGrid, and Moving the Edit Function in a DataGrid Schultz ASP .Net 3 02-14-2005 04:47 AM
Change style of a single row of the item list of datagrid, based on a field value of current item... QUASAR ASP .Net Datagrid Control 6 01-17-2004 07:46 PM



Advertisments