Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Referencing child controls on a formview

Reply
Thread Tools

Referencing child controls on a formview

 
 
Neil
Guest
Posts: n/a
 
      02-07-2006
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

 
Reply With Quote
 
 
 
 
Neil
Guest
Posts: n/a
 
      02-08-2006
Does no-one have a solution for this.

I can't see anything mentioned in books or on MSDN as to how I can do
this.

Neil

 
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
Referencing Controls on ItemTemplate in FormView Control mike@5starserv.com ASP .Net Web Controls 2 01-28-2007 01:23 PM
strange inconsistency referencing controls in Formview itemtemplate Ned Balzer ASP .Net 4 08-03-2006 05:14 PM
Referencing controls within a Formview msch-prv@bluewin.ch ASP .Net 1 07-26-2006 05:21 PM
Referencing child controls on a formview Neil ASP .Net 0 02-07-2006 10:34 AM
HELP! Child controls of child controls not visible to web app lisa@starways.net ASP .Net Building Controls 0 05-05-2005 09:14 PM



Advertisments