datagrid checkbox list edit item not working

C

cindy

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?
 
S

Steven Cheng[MSFT]

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=?=" <[email protected]>
| Subject: datagrid checkbox list edit item not working
| Date: Tue, 18 Oct 2005 12:40:13 -0700
| Lines: 14
| Message-ID: <[email protected]>
| 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.datagridcontrol
| NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA02.phx.gbl!TK2MSFTNGXA03.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet.datagridcontrol:5812
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.datagridcontrol
|
| 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
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,708
Latest member
SherleneF1

Latest Threads

Top