Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > checkbox problems in datagrid

Reply
Thread Tools

checkbox problems in datagrid

 
 
John
Guest
Posts: n/a
 
      01-05-2006
Hi all, i've added a checkbox column to my datagrid using template columns,
and i added a checkbox to the header for check all and uncheck all
functionality. the purpose of this is to allow the users to select records
from the list and add them to another list when the push a button. My
problem is that the checked value never survives postback. in other words i
can find the controls, i used some online articles to figure out how to do
this, but the chkbox.checked value is always false even if i hard code it to
be true in the html. i've tried both asp:checkbox and HtmlInputControl
checkboxes, both have the same problem. i've also tried with and without
paging enabled on the datagrid and nothing helps.
heres the c# code i'm using to try to get the values

foreach( DataGridItem di in dgListData.Items )
{
if(di.FindControl("chkInclude")!=null)
Trace.Write("in foreach");
HtmlInputCheckBox chkBx =
(HtmlInputCheckBox)di.FindControl("chkInclude") ;

if( chkBx !=null )
{
Trace.Write("In if",chkBx.Checked.ToString()+" value
"+chkBx.Value.ToString());
lblIncludeError.Visible=true;
lblIncludeError.Text="It worked";
}
}
 
Reply With Quote
 
 
 
Reply

Thread Tools

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
DataGrid and embeded Checkbox..How to find if checkbox clicked =?Utf-8?B?RG90TmV0RGV2?= ASP .Net 1 10-06-2006 04:11 PM
Howto bind CheckBox to the datagrid/ Then update the database field when the checkbox is clicked. Joey Pang ASP .Net Datagrid Control 4 06-13-2005 02:29 AM
Text on Checkbox below the checkbox tshad ASP .Net 0 04-14-2005 11:26 PM
Added CheckBox to a DataGrid Doesn't work with DataGrid.Enabled=False Amar ASP .Net 0 04-06-2004 10:14 AM
Added CheckBox to a DataGrid Doesn't work with DataGrid.Enabled=False Amar ASP .Net Building Controls 0 04-06-2004 10:14 AM



Advertisments