Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   Referencing child controls on a formview (http://www.velocityreviews.com/forums/t119079-referencing-child-controls-on-a-formview.html)

Neil 02-07-2006 10:34 AM

Referencing child controls on a formview
 
I want to be able to set the enabled status of certain controls on the
edititem template of a formview control based on whether a check box is
checked or not (or the value coming from the database as stored by the
sqldatasource) .

I've tried code such as:

CheckBox cb =
(CheckBox)FormView1.Row.FindControl("SysDefMethod" );
Button ub = (Button)FormView1.Row.FindControl("UpdateButton");
if (cb.Checked == true)
{
ub.Enabled = false;
}

in various events (formview databound & databinding, sqldatasource
selected) but always get an "Object reference not set to an instance of
an object." exception when the "if (cb.Checked == true)" line is
executed.

The item to be displayed in the formview is chosen from a gridview. I
have no problem getting the data displayed or updated, its just that I
now want to restrict the fields that are available to the user based on
the value of SysDefMethod (it's a bit field in the database).


Thanks in advance



All times are GMT. The time now is 06:44 AM.

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