473,508 Members | 2,445 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="SqlDataSource3"
OnItemCreated="fvProject_ItemCreated" 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_ItemCreated(object sender, EventArgs e)
{
DataRowView DRV = (DataRowView)fvProject.DataItem;

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

i've also tried manually assigning the event handler,
protected override void OnInit(EventArgs e)
{
fvProject.ItemCreated += new
EventHandler(fvProject_ItemCreated);
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 1597

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...
0
1375
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...
0
1105
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...
4
3430
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
8630
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...
8
7047
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...
0
1064
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...
13
1914
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...
6
6072
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...
0
7114
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
7321
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,...
1
7034
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...
1
5045
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...
0
4702
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...
0
3191
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...
0
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1544
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
762
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.