Hi
I'm having trouble trying to use FindControl with a FormView, but can't seem
to find what I'm doing wrong....
I have a TextBox in my ItemTemplate, and I want to assign a value to it, in
code...
I'm trying:
((TextBox)FormView1.FindControl("TextBox1")).Text = "Sample value";
The error reported is 'Object reference not set to an instance of an
object.'
Any ideas?
Thanks 6 9404
Paul where are you doing that?
Patrick
**It seems it can't find the control
"Paul Aspinall" <pa**@aspy.co.uk> wrote in message
news:UH******************@fe1.news.blueyonder.co.u k... Hi I'm having trouble trying to use FindControl with a FormView, but can't seem to find what I'm doing wrong....
I have a TextBox in my ItemTemplate, and I want to assign a value to it, in code...
I'm trying:
((TextBox)FormView1.FindControl("TextBox1")).Text = "Sample value"; The error reported is 'Object reference not set to an instance of an object.' Any ideas? Thanks
I've tried it in a few places, prerender, load, databinding etc.
No joy anywhere.
Has anyone actually managed to do this in C#??
Thanks
"Patrick.O.Ige" <na********@hotmail.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl... Paul where are you doing that? Patrick **It seems it can't find the control
"Paul Aspinall" <pa**@aspy.co.uk> wrote in message news:UH******************@fe1.news.blueyonder.co.u k... Hi I'm having trouble trying to use FindControl with a FormView, but can't seem to find what I'm doing wrong....
I have a TextBox in my ItemTemplate, and I want to assign a value to it, in code...
I'm trying:
((TextBox)FormView1.FindControl("TextBox1")).Text = "Sample value"; The error reported is 'Object reference not set to an instance of an object.' Any ideas? Thanks
This may help.
protected override void OnInit(EventArgs e)
{
FormView1.ItemCreated += new
EventHandler(FormView1_ItemCreated);
base.OnInit(e);
}
void FormView1_ItemCreated(object sender, EventArgs e)
{
TextBox t = (TextBox)FormView1.Row.FindControl("TextBox1");
t.Text = "foo";
}
Chris
Doh - Fixed it...
Thanks anyway
Paul
"Paul Aspinall" <pa**@aspy.co.uk> wrote in message
news:lX*******************@fe2.news.blueyonder.co. uk... I've tried it in a few places, prerender, load, databinding etc.
No joy anywhere.
Has anyone actually managed to do this in C#??
Thanks
"Patrick.O.Ige" <na********@hotmail.com> wrote in message news:%2****************@tk2msftngp13.phx.gbl... Paul where are you doing that? Patrick **It seems it can't find the control
"Paul Aspinall" <pa**@aspy.co.uk> wrote in message news:UH******************@fe1.news.blueyonder.co.u k... Hi I'm having trouble trying to use FindControl with a FormView, but can't seem to find what I'm doing wrong....
I have a TextBox in my ItemTemplate, and I want to assign a value to it, in code...
I'm trying:
((TextBox)FormView1.FindControl("TextBox1")).Text = "Sample value"; The error reported is 'Object reference not set to an instance of an object.' Any ideas? Thanks
What was it Paul?
I get the same error.
Cheers,
Nick
"Paul Aspinall" <pa**@aspy.co.uk> wrote in message
news:k7*******************@fe2.news.blueyonder.co. uk... Doh - Fixed it...
Thanks anyway
Paul
"Paul Aspinall" <pa**@aspy.co.uk> wrote in message news:lX*******************@fe2.news.blueyonder.co. uk... I've tried it in a few places, prerender, load, databinding etc.
No joy anywhere.
Has anyone actually managed to do this in C#??
Thanks
"Patrick.O.Ige" <na********@hotmail.com> wrote in message news:%2****************@tk2msftngp13.phx.gbl... Paul where are you doing that? Patrick **It seems it can't find the control
"Paul Aspinall" <pa**@aspy.co.uk> wrote in message news:UH******************@fe1.news.blueyonder.co.u k... Hi I'm having trouble trying to use FindControl with a FormView, but can't seem to find what I'm doing wrong....
I have a TextBox in my ItemTemplate, and I want to assign a value to it, in code...
I'm trying:
((TextBox)FormView1.FindControl("TextBox1")).Text = "Sample value"; The error reported is 'Object reference not set to an instance of an object.' Any ideas? Thanks
Hi Nick,
I've emailed you.
Cheers
"Nick" <ni**********@gmail.com> wrote in message
news:O%***************@TK2MSFTNGP14.phx.gbl... What was it Paul?
I get the same error.
Cheers,
Nick
"Paul Aspinall" <pa**@aspy.co.uk> wrote in message news:k7*******************@fe2.news.blueyonder.co. uk... Doh - Fixed it...
Thanks anyway
Paul
"Paul Aspinall" <pa**@aspy.co.uk> wrote in message news:lX*******************@fe2.news.blueyonder.co. uk... I've tried it in a few places, prerender, load, databinding etc.
No joy anywhere.
Has anyone actually managed to do this in C#??
Thanks
"Patrick.O.Ige" <na********@hotmail.com> wrote in message news:%2****************@tk2msftngp13.phx.gbl... Paul where are you doing that? Patrick **It seems it can't find the control
"Paul Aspinall" <pa**@aspy.co.uk> wrote in message news:UH******************@fe1.news.blueyonder.co.u k... > Hi > I'm having trouble trying to use FindControl with a FormView, but > can't seem to find what I'm doing wrong.... > > I have a TextBox in my ItemTemplate, and I want to assign a value to > it, in code... > > I'm trying: > > ((TextBox)FormView1.FindControl("TextBox1")).Text = "Sample value"; > > > > The error reported is 'Object reference not set to an instance of an > object.' > > > > Any ideas? > > > > Thanks > >
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: sck10 |
last post by:
Hello,
I am trying to bind an arraylist to a FormView DropDownList control in the
PreRender state. The error that I get is the following:
Databinding methods such as Eval(), XPath(), and...
|
by: Islamegy® |
last post by:
I'm use FormView for editing a photo gallery... I add FileUpload control to
upload images to the Gallery.
I'm binding my Formview to objectdatasource
i tried upload images onItemInserting &...
|
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...
|
by: Paul |
last post by:
Hello:
I have an aspx page with a Formview and a Gridview on it.
I have a dropdownlist control which I want to bind to both the Formview and
the Gridview.
I put the dropdownlist in the...
|
by: YMPN |
last post by:
Hi Everyone,
I'm deen from Riyadh.
Please do help me with some problem i have. I have this formview
control setup to recieved inputs from user (textbox, dropdownlist,
others).
After...
|
by: J055 |
last post by:
Hi
I have a PlaceHolder control inside a FormView EditItemTemplate:
<asp:PlaceHolder ID="phResponseText" runat="server">
<tr>
<td>
<asp:Label ID="lblResponseText"...
|
by: Trev |
last post by:
Hi,
I'm hoping that someone in this group can shed some light on an issue
I'm having with a Formview.
I have a Web User Control (.ascx) with a Formview. The Formview
contains 2 Multiviews,...
|
by: Chris |
last post by:
I want do my insert to a database using a formview bound to an
objectdatasource. I also want to upload a file. I'm quite new to and this is
just test code but Is there any way I can pass the file...
|
by: J055 |
last post by:
Hi
I can't figure out what the difference is here. Sometimes I have a simple
FormView control in a page and I can use the FormView.FindControl method to
get a Label or TextBox with in it during...
|
by: pankajsingh5k |
last post by:
Hi guys,
These question is for all the experts...
Please help me before my brain explodes
The problem is again with the formview control..
I have a formview and i have to use it that...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
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
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
| |