473,663 Members | 2,854 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Reading Values from FormView Ctrl - Object reference not set to an instance of an object.

Hi all,

I am getting an error message "Object reference not set to an instance
of an object." when i try to read values that are inside FormView
control. I am just trying to read the values displayed in a formview
control to be used elsewhere in the same page. Below is the code that
i've used

in the aspx page,
<asp:FormView ID="fvProject" DataSourceID="S qlDataSource3"
OnItemCreated=" fvProject_ItemC reated" runat="server" >
<ItemTemplate >
Domain:
<asp:Label ID="domainLabel " runat="server" Text='<%#
Bind("domain") %>'></asp:Label><br />
</ItemTemplate>
</asp:FormView>

in the aspx.cs page,
protected void fvProject_ItemC reated(object sender, EventArgs e)
{
DataRowView DRV = (DataRowView)fv Project.DataIte m;

string myString = DRV["domain"].ToString();
//This is where the error occurs
}

i've also tried manually assigning the event handler,
protected override void OnInit(EventArg s e)
{
fvProject.ItemC reated += new
EventHandler(fv Project_ItemCre ated);
base.OnInit(e);
}
but still its not working,
Can someone please tell me how to read values displayed in a FormView
contorl.

Thanks,
Prakash

Dec 14 '06 #1
0 1600

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 = (Button)FormView1.Row.FindControl("UpdateButton");
0
1381
by: Rabbit | last post by:
Hi, All, I have a FormView, in which the InsertItemTemplate has a dropdownlist that I need to set the datasource as my self created dataset. I have been trying various syntax like following at formview Init or ItemCreated event: Dim cbo As DropDownList = CType(Me.fmViewUser.Row.Cells(0).FindControl("ddNameInsert"), DropDownList) or
0
1110
by: Chris | last post by:
I am using the formview control. Within its edit template I have a treeview, which I populate programatically. Initially I had an item template in which I had a button, which triggered the edit template. The treeview was populated with the following code Protected Sub FormView1_ItemCreated(ByVal sender As Object, ByVal e As System.EventArgs) If FormView1.CurrentMode = FormViewMode.Edit Or FormView1.CurrentMode = FormViewMode.Insert Then...
4
3433
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 know why, can you suggest a workaround? Here is the code: Protected Sub Page_Load(ByVal sender...
2
8633
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 control.
8
7065
by: BB | last post by:
Hi, I am using FormView Contol, TextBox (Hidden ) and Submit button whose caption is "View Page" in my aspx page. Here is what I am tryin to do.When page loads I generate dynamic url in text box . I want to append exisitng value in Formview field "CustomeID" to url. When userclicks on "view page" ,new window is opened with dynamic url. I am able to do generarting url dynamically, but dont know how i can do rest of the things. Any idea?
0
1078
by: MRW | last post by:
For some strange reason, I'm having problems finding a GridView in a FormView. I keep getting the error: Object reference not set to an instance of an object. I have the code below, it's very simple, yet I can't 'grab' my gridview. Can anybody help me out on this? ----
13
1931
by: Marc | last post by:
The first part of the below writes the name and location of all buttons on a from to a text file. The second part reads that information back in and recreates the buttons. My problem is reading the location value back in where I marked ?????????????????????. As it wont accept a string value? Private Sub Save_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Save.Click
6
6078
by: jobs | last post by:
This code was working, but then stopped working. I don't think I completely understand it. I pass it a formview name and it would loop through checking the value of textboxes. problem is now as i debug it, it's telling me there are only a count of 3 controls in that for loop. and they have clientid values like: ctl00_Content1_FormMaint_ctl03
0
8436
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8345
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8548
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7371
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6186
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5657
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4182
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2000
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1757
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.