datagrid checkbox list edit item not working

Ask a Question related to ASP.NET Data Grid Control, Design and Development.

  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. Similar Questions and Discussions

    1. Howto bind CheckBox to the datagrid/ Then update the database field when the checkbox is clicked.
      I am trying to update the database field when the checkbox is clicked. I am trying to modified the following solution but.. got stuck on the...
    2. Datagrid Edit, Insert & Update Checkbox (ASP.NET Using VB.NET)
      Hi you guys. If you could possible help me here. I am quite new to .NET coming over from VB and with limited ASP development. I am having a problem...
    3. How to set selected item in drop-down list in datagrid
      Donald Welker wrote: SelectedValue='<%# DataBinder.Eval(Container.DataItem,"ABCField") %>' -- Jos
    4. Change style of a single row of the item list of datagrid, based on a field value of current item...
      Sorry for the long subject guys, but I don't know how better I can resume the matter... Anyway, I have my datagrid showing items of an order. I...
    5. Datagrid Item Delete Confirmation not working
      Hi Experts, All of sudden the delete confirmation is not working for me on my datagrid (it was working 2 days ago..couldn't figure out the...
  3. #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=?=" <cmello@nospam.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-867DBBEA89BA@microsoft.com>
    | 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
    |

    Steven Cheng[MSFT] Guest

Posting Permissions

  • You may not post new threads
  • You may 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