check CheckBoxList in DataGrid

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mats

    check CheckBoxList in DataGrid

    Hi

    I am working on a webapplication using Asp.net with C#. I
    have Datagrid that have 3 colums two of them are text but
    the last one is a CheckBoxList. I have manage to set data
    to the CheckBoxList but I haven't found a way to select
    those checkbox that I will.

    I read data from a database and will make a table with two
    text columns and one column filled with several
    checkboxes. Each row can have different number of
    checkboxes with different names. Some of the checkboxes
    will be checked some ones not.


    <asp:DataGrid id="dg" AutoGenerateCol umns="False"
    runat="server">
    <Columns>
    <asp:BoundColum n DataField="Name "
    HeaderText="Sid namn"></asp:BoundColumn >
    <asp:BoundColum n DataField="Url"
    HeaderText="Url "></asp:BoundColumn >
    <asp:TemplateCo lumn HeaderText="Beh örighet">
    <ItemTemplate >
    <asp:checkboxli st DataSource="<%# GetData() %[color=blue]
    >" RepeatDirection ="Horizontal " [/color]
    DataValueField= "ValueField " DataTextField=" Name"
    runat="server" ID="Checkboxlis t2">
    </asp:checkboxlis t>
    </ItemTemplate>
    </asp:TemplateCol umn>
    </Columns>
    </asp:DataGrid>

    The GetData() method is returning a DataView.

    I have try to set selection I OnPreRender fore the page
    but than I only can set selection I one row.

    Can someone help me how to solve it

    Thanks
    /Mats

  • Curt_C [MVP]

    #2
    Re: check CheckBoxList in DataGrid

    I'd suggest a DotNet group. This one is for ASP, not ASPX


    --
    ----------------------------------------------------------
    Curt Christianson (Software_AT_Da rkfalz.Com)
    Owner/Lead Designer, DF-Software

    ---------------------------------------------------------
    ...Offering free scripts & code snippits for everyone...
    ---------------------------------------------------------

    "Mats" <mli@oreline.ne t> wrote in message
    news:029c01c352 21$70fe7ab0$a40 1280a@phx.gbl.. .
    Hi

    I am working on a webapplication using Asp.net with C#. I
    have Datagrid that have 3 colums two of them are text but
    the last one is a CheckBoxList. I have manage to set data
    to the CheckBoxList but I haven't found a way to select
    those checkbox that I will.

    I read data from a database and will make a table with two
    text columns and one column filled with several
    checkboxes. Each row can have different number of
    checkboxes with different names. Some of the checkboxes
    will be checked some ones not.


    <asp:DataGrid id="dg" AutoGenerateCol umns="False"
    runat="server">
    <Columns>
    <asp:BoundColum n DataField="Name "
    HeaderText="Sid namn"></asp:BoundColumn >
    <asp:BoundColum n DataField="Url"
    HeaderText="Url "></asp:BoundColumn >
    <asp:TemplateCo lumn HeaderText="Beh örighet">
    <ItemTemplate >
    <asp:checkboxli st DataSource="<%# GetData() %[color=blue]
    >" RepeatDirection ="Horizontal "[/color]
    DataValueField= "ValueField " DataTextField=" Name"
    runat="server" ID="Checkboxlis t2">
    </asp:checkboxlis t>
    </ItemTemplate>
    </asp:TemplateCol umn>
    </Columns>
    </asp:DataGrid>

    The GetData() method is returning a DataView.

    I have try to set selection I OnPreRender fore the page
    but than I only can set selection I one row.

    Can someone help me how to solve it

    Thanks
    /Mats


    Comment

    Working...