473,387 Members | 1,597 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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

Feb 7 '06 #1
1 1430
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

Feb 8 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Neil | last post by:
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...
9
by: Dick | last post by:
How do I set the focus to a control that is a child to a FormView? I've tried the obvious (below) and lots of variations but none seam to work! Sub Page_Load(ByVal sender As Object, ByVal e As...
0
by: Chris | last post by:
I want to display a formview based on an objectdatasource. One of the things on the formview will be a link to a pdf. When I go into the edit template I would like a fileupload to display, which...
1
by: msch-prv | last post by:
Sorry to bother. This is somewhat related to a post I made today. But I am really stuck! Is it possible to directly reference a control within a form view? For example, is it possible to assign...
4
by: Ned Balzer | last post by:
Can anyone explain why in the following code, where btnCancel1 is a Button inside the itemTemplate of the formview, the first call to change the text of the button, in the Page_Load sub, works...
2
by: wikkiwikkiwaa | last post by:
hello, i am trying to access controls inside my formview1 nested inside loginview1. you cannot access the formview1 unless you are properly logged in. for loginview1, that seems to be fairly...
2
by: PW | last post by:
I wish to get and set values on child controls on a formview. For example. Changing the text in textbox. Hiding or unhiding child controls based on user. Replacing a blank with a default or...
0
by: namewitheldbyrequest | last post by:
I have a FrameView control on a form. In the FrameView is a DropDownList that has as its datasource an ObjectDataSource object. The ObjectDataSource is not in the FrameView because I get an error...
1
by: Andrew Hayes | last post by:
I have a parent page with a gridview, and a child page with a formview. Using the solution on velocityreviews: ...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.