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