By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,712 Members | 1,430 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,712 IT Pros & Developers. It's quick & easy.

check CheckBoxList in DataGrid

P: n/a
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" AutoGenerateColumns="False"
runat="server">
<Columns>
<asp:BoundColumn DataField="Name"
HeaderText="Sidnamn"></asp:BoundColumn>
<asp:BoundColumn DataField="Url"
HeaderText="Url"></asp:BoundColumn>
<asp:TemplateColumn HeaderText="Behörighet">
<ItemTemplate>
<asp:checkboxlist DataSource="<%# GetData() %
" RepeatDirection="Horizontal"

DataValueField="ValueField" DataTextField="Name"
runat="server" ID="Checkboxlist2">
</asp:checkboxlist>
</ItemTemplate>
</asp:TemplateColumn>
</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

Jul 19 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
I'd suggest a DotNet group. This one is for ASP, not ASPX
--
----------------------------------------------------------
Curt Christianson (Software_AT_Darkfalz.Com)
Owner/Lead Designer, DF-Software
http://www.Darkfalz.com
---------------------------------------------------------
...Offering free scripts & code snippits for everyone...
---------------------------------------------------------

"Mats" <ml*@oreline.net> wrote in message
news:02****************************@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" AutoGenerateColumns="False"
runat="server">
<Columns>
<asp:BoundColumn DataField="Name"
HeaderText="Sidnamn"></asp:BoundColumn>
<asp:BoundColumn DataField="Url"
HeaderText="Url"></asp:BoundColumn>
<asp:TemplateColumn HeaderText="Behörighet">
<ItemTemplate>
<asp:checkboxlist DataSource="<%# GetData() %
" RepeatDirection="Horizontal"

DataValueField="ValueField" DataTextField="Name"
runat="server" ID="Checkboxlist2">
</asp:checkboxlist>
</ItemTemplate>
</asp:TemplateColumn>
</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
Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.