PC Review


Reply
Thread Tools Rate Thread

datagrid and checkboxes

 
 
Luis Carvalho
Guest
Posts: n/a
 
      5th Dec 2003
Hi!
I have a Datagrid with a column that is a checkbox.
Something like this:

<asp:datagrid id="dg2" runat="server">
<Columns>
<asp:TemplateColumn>
<ItemTemplate>
<asp:CheckBox ID="chkSelection" Runat="server" />
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:datagrid>

in an aspx. When I load de aspx i bind it with a datatable
so i get a datagrid with the columns and rows of the
datatable and the first column is a checkbox.
I now want to get the values of the rows in wich the
checkbok is checked.

I tried something like:

foreach(DataGridItem dgit in dg2.Items)
{
chkse = dgit.FindControl("chkSelection") as CheckBox;
if (chkse.Checked)
{
//code in here
}

}

so far so good. I've read that i can use another
FindControl to get the values, but I have to do a cast
(CType in VB although I am using c#) to the control as a
label and all I get is null.
Is there a way to get all the values of the row. Like an
iterator for that row in that specific DataItem?

Thank You
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
CheckBoxes in DataGrid rn5a@rediffmail.com Microsoft ASP .NET 7 5th Dec 2006 09:48 AM
CheckBoxes in DataGrid drakuu@gmail.com Microsoft ASP .NET 2 5th Feb 2006 01:56 PM
CheckBoxes in DataGrid drakuu@gmail.com Microsoft ADO .NET 1 5th Feb 2006 01:24 PM
DataGrid with checkboxes GatorBait Microsoft VB .NET 3 22nd Sep 2005 09:45 PM
DataGrid with checkboxes Jerry Microsoft Dot NET Framework 3 7th Mar 2004 07:54 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:13 PM.