Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 3.5 > ASP.NET 3.5 Basics
|
ASP.NET 3.5 Basics If you are new to ASP or ASP.NET programming with version 3.5, this is the forum to begin asking questions. Please also see the Visual Web Developer 2008 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 3.5 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 29th, 2008, 11:56 PM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 479
Thanks: 0
Thanked 3 Times in 3 Posts
Send a message via MSN to surendran Send a message via Yahoo to surendran
Default how to get the value checkbox from datagrid

I have one datagrid in which i am using templatecolumn and added a checkbox control.

onclick assigned a value to it by using javascript.

now onsubmit i want that value

What is the way to get that value???

what I am tried is which is not working:

private void Button1_Click(object sender, System.EventArgs e)
{
foreach( DataGridItem di in Grid1.Items )
{
if (((CheckBox) di.FindControl("chkBx")).Checked)
{
Label1.Text += ((CheckBox) di.FindControl("chkBx")).Text;

}
}

surendran
(Anything is Possible)
http://www.suren.info
http://ssuren.spaces.msn.com
__________________
surendran
(Anything is Possible)
http://www.suren.info
http://ssuren.spaces.msn.com
 
Old September 30th, 2008, 08:04 AM
Friend of Wrox
 
Join Date: Nov 2007
Posts: 207
Thanks: 2
Thanked 15 Times in 15 Posts
Default

Try this...

foreach (DataGridItem di in Grid1.Items) {
         if (di is CheckBox) {
             if (((CheckBox)di.FindControl("chkBx")).Checked) {
                 Label1.Text = Label1.Text + ((CheckBox)di.FindControl("chkBx")).Text;
             }
         }
     }

Jason Hall
 
Old September 30th, 2008, 10:56 PM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 479
Thanks: 0
Thanked 3 Times in 3 Posts
Send a message via MSN to surendran Send a message via Yahoo to surendran
Default

thanks mate, it's really helpfull

surendran
(Anything is Possible)
http://www.suren.info
http://ssuren.spaces.msn.com





Similar Threads
Thread Thread Starter Forum Replies Last Post
CheckBox in Datagrid sumith ASP.NET 1.0 and 1.1 Professional 1 March 21st, 2007 06:25 AM
checkbox in datagrid asad_prog VB.NET 0 November 25th, 2006 02:41 PM
CheckBox in DataGrid Baby_programmer ASP.NET 1.x and 2.0 Application Design 2 March 11th, 2005 12:42 AM
CheckBox in DataGrid Baby_programmer ASP.NET 1.0 and 1.1 Basics 1 March 3rd, 2005 08:33 PM
checkbox in datagrid joekske VB How-To 1 June 3rd, 2004 02:31 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.