Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net Datagrid Control (http://www.velocityreviews.com/forums/f60-asp-net-datagrid-control.html)
-   -   checkbox problems in datagrid (http://www.velocityreviews.com/forums/t762545-checkbox-problems-in-datagrid.html)

John 01-05-2006 08:15 PM

checkbox problems in datagrid
 
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";
}
}


All times are GMT. The time now is 06:27 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.