DataGridView and CheckBox column checked event

788 views
Skip to first unread message

Joe

unread,
Apr 26, 2007, 3:26:00 PM4/26/07
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
Hi

I have a DataGridView control on which I added a CheckBox column. I
want to catch up when the user check one CheckBox on a particular row.
How to achieve this? I looked at different events that are fired on
the DataGridView but could not find somwthing interesting.

Thanks in advance.

ai

unread,
Apr 26, 2007, 10:03:34 PM4/26/07
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting

hi, i'm not sure if this can help, but i used this code for my C#
project.

//for each row in datagrid:
for(x=0;x<myDatagrid.items.count;x++)
{
//this.myDataGrid.Items[x].Cells[1].Controls[1] --> will be the
position of your checkbox in datagrid.
CheckBox myCbx = (CheckBox)
this.myDataGrid.Items[x].Cells[1].Controls[1];
if (myCbx .Checked)
{
//your code
}
}

cheers;


Chief Bugs

unread,
Apr 27, 2007, 1:42:30 AM4/27/07
to DotNetDe...@googlegroups.com
Hi Joe,
 
You can use CommandArgument and CommandName property of the checkbox, you can handle that on DataGrid.ItemCommand event. This event contains CommandName of the check box on System.Web.UI.WebControls.DataGridCommandEventArgs .

 

Biju Varghese

unread,
Apr 27, 2007, 4:53:42 AM4/27/07
to DotNetDe...@googlegroups.com
is this for vb.net or asp.net.
 
asp.net has got readymade solution.  u can do it easily
 
bye
biju

 

Mr.roy

unread,
Apr 27, 2007, 11:47:41 AM4/27/07
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
Hi friends,

I want to implement logic in my application .. based on the time it
should be exit and restart the system.. for that in Visual Basic Exit
windows commond we can do that.. but in c# how can i implement that ..
please tell me

thanks&regards

Roy

Joe

unread,
Apr 30, 2007, 8:34:17 AM4/30/07
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
It is for Win32 app.

On Apr 27, 4:53 am, "Biju Varghese" <biju...@gmail.com> wrote:
> is this for vb.net or asp.net.
>
> asp.net has got readymade solution. u can do it easily
>
> bye
> biju
>

> On 4/27/07, Joe <jonathanpou...@videotron.qc.ca> wrote:
>
>
>
>
>
> > Hi
>
> > I have a DataGridView control on which I added a CheckBox column. I
> > want to catch up when the user check one CheckBox on a particular row.
> > How to achieve this? I looked at different events that are fired on
> > the DataGridView but could not find somwthing interesting.
>

> > Thanks in advance.- Hide quoted text -
>
> - Show quoted text -

Joe

unread,
Apr 30, 2007, 8:34:50 AM4/30/07
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
Thanks. I found it just before you post! ;-)
Reply all
Reply to author
Forward
0 new messages