473,569 Members | 2,984 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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)FormV iew1.Row.FindCo ntrol("SysDefMe thod");
Button ub = (Button)FormVie w1.Row.FindCont rol("UpdateButt on");
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 1442
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
324
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 as stored by the sqldatasource) . I've tried code such as: CheckBox cb = (CheckBox)FormView1.Row.FindControl("SysDefMethod"); Button ub =...
9
2802
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 System.EventArgs) Handles Me.Load Me.FormView1.Row.FindControl("TextBox1").Focus() End Sub
0
1095
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 can be used to upload a new pdf. I would like my object to be as reusable as possible. Can anyone recommend a way of referencing the fileupload...
1
1380
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 the text attribute of a control using a control that is databound to a db? Or, must that be done via a specific script? I created an script using...
4
3431
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 fine, but the second call, in the bookFormView_ItemUpdated sub, throws an exception (Object reference not set to an instance of an object)? And if you...
2
8632
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 simple. a label control would be: Label label1 = (Label)loginview1.FindControl("nameoflabel"); then i get to the data that was bound to that...
2
1487
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 calculated value that will need to be generated at runtime. It seems as though this should be thoroughly documented, but I'm not finding much. ...
0
1135
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 when I try to edit the page source to put it in. The ObjectDataSource has a parameter that is mapped to another control that is in the FarmeView....
1
3384
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: http://www.velocityreviews.com/forums/t80654-solution-raising-an-event-handler-postback-on-parent-window-from-popup-child-window-dialog-box.html I was able to create the Parent and Child Window custom controls and get them to...
0
7703
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7930
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8138
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7983
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6290
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5228
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3662
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1229
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.