Professional Web Applications Themes

datagrid checkbox list edit item not working - ASP.NET Data Grid Control

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 ...

  1. #1

    Default datagrid checkbox list edit item not working

    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
    cindy Guest

  2. #2

    Default RE: datagrid checkbox list edit item not working

    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! [url]www.microsoft.com/security[/url]
    (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=?=" <cmellonospam.nospam>
    | 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-867DBBEA89BAmicrosoft.com>
    | MIME-Version: 1.0
    | Content-Type: text/plain;
    | cht="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
    |

    Steven Cheng[MSFT] Guest

Similar Threads

  1. Replies: 4
    Last Post: June 13th, 02:29 AM
  2. Datagrid Edit, Insert & Update Checkbox (ASP.NET Using VB.NET)
    By Jacobus Visser via DotNetMonster.com in forum ASP.NET Data Grid Control
    Replies: 2
    Last Post: April 7th, 10:19 PM
  3. How to set selected item in drop-down list in datagrid
    By Jos in forum ASP.NET Building Controls
    Replies: 0
    Last Post: August 20th, 07:46 AM
  4. Replies: 6
    Last Post: January 17th, 07:46 PM
  5. Datagrid Item Delete Confirmation not working
    By Nedu N in forum ASP.NET Data Grid Control
    Replies: 2
    Last Post: December 4th, 02:16 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139