hi,
sorry for re-posting but it's a simple question and ought to have a very
simple solution; I am trying to use Findcontrol to grab a Button control
within a Formview control:
<form ID="Form1" runat="server">
<asp:FormView ID="FormView1" Runat="server">
<ItemTemplate >
<asp:Button ID="Button1" runat="server" Text="Breyta" CommandName="Ed it"/>
...
This is what won't work:
Button Button1 = (Button) FormView1.FindC ontrol("Button1 "); 4 4930
Being too lazy to load up VWD, try using:
FormView1.Row.F indControl("But ton1")
In a repeater, you'd have multiple "Button1"'s and would need to look at
repeater.Items[i].FindControl
FormViews are the same..though there's only 1 row...so it's exposed as Row
(if I remember correctly).
Karl
--
MY ASP.Net tutorials http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying) http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Daves" <db****@simnet. is> wrote in message
news:us******** ******@TK2MSFTN GP09.phx.gbl... hi, sorry for re-posting but it's a simple question and ought to have a very simple solution; I am trying to use Findcontrol to grab a Button control within a Formview control:
<form ID="Form1" runat="server"> <asp:FormView ID="FormView1" Runat="server"> <ItemTemplate > <asp:Button ID="Button1" runat="server" Text="Breyta"
CommandName="Ed it"/> ...
This is what won't work: Button Button1 = (Button) FormView1.FindC ontrol("Button1 ");
thx Karl, tried that and bloody error "Object reference not set to an
instance of an object."
Button Button1 = (Button) FormView1.Row.F indControl("But ton1");
"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:O3******** ******@TK2MSFTN GP10.phx.gbl... Being too lazy to load up VWD, try using: FormView1.Row.F indControl("But ton1")
In a repeater, you'd have multiple "Button1"'s and would need to look at repeater.Items[i].FindControl
FormViews are the same..though there's only 1 row...so it's exposed as Row (if I remember correctly).
Karl
-- MY ASP.Net tutorials http://www.openmymind.net/ - New and Improved (yes, the popup is annoying) http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to come!) "Daves" <db****@simnet. is> wrote in message news:us******** ******@TK2MSFTN GP09.phx.gbl... hi, sorry for re-posting but it's a simple question and ought to have a very simple solution; I am trying to use Findcontrol to grab a Button control within a Formview control:
<form ID="Form1" runat="server"> <asp:FormView ID="FormView1" Runat="server"> <ItemTemplate > <asp:Button ID="Button1" runat="server" Text="Breyta" CommandName="Ed it"/> ...
This is what won't work: Button Button1 = (Button) FormView1.FindC ontrol("Button1 ");
i started it up and it worked fine for me...as you sure you are calling
DataBind on the FormView? Are you sure the datasource has an entry in it?
Karl
--
MY ASP.Net tutorials http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying) http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Daves" <db****@simnet. is> wrote in message
news:uu******** ******@TK2MSFTN GP10.phx.gbl... thx Karl, tried that and bloody error "Object reference not set to an instance of an object." Button Button1 = (Button) FormView1.Row.F indControl("But ton1");
"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net> wrote in message news:O3******** ******@TK2MSFTN GP10.phx.gbl... Being too lazy to load up VWD, try using: FormView1.Row.F indControl("But ton1")
In a repeater, you'd have multiple "Button1"'s and would need to look at repeater.Items[i].FindControl
FormViews are the same..though there's only 1 row...so it's exposed as
Row (if I remember correctly).
Karl
-- MY ASP.Net tutorials http://www.openmymind.net/ - New and Improved (yes, the popup is annoying) http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to come!) "Daves" <db****@simnet. is> wrote in message news:us******** ******@TK2MSFTN GP09.phx.gbl... hi, sorry for re-posting but it's a simple question and ought to have a
very simple solution; I am trying to use Findcontrol to grab a Button
control within a Formview control:
<form ID="Form1" runat="server"> <asp:FormView ID="FormView1" Runat="server"> <ItemTemplate > <asp:Button ID="Button1" runat="server" Text="Breyta" CommandName="Ed it"/> ...
This is what won't work: Button Button1 = (Button) FormView1.FindC ontrol("Button1 ");
Databind() did it...
which I still don't understand! There was an entry in it without doing
databind, could it be that Databind is done later in the event flow?
"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:%2******** ********@TK2MSF TNGP10.phx.gbl. .. i started it up and it worked fine for me...as you sure you are calling DataBind on the FormView? Are you sure the datasource has an entry in it?
Karl
-- MY ASP.Net tutorials http://www.openmymind.net/ - New and Improved (yes, the popup is annoying) http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to come!) "Daves" <db****@simnet. is> wrote in message news:uu******** ******@TK2MSFTN GP10.phx.gbl... thx Karl, tried that and bloody error "Object reference not set to an instance of an object." Button Button1 = (Button) FormView1.Row.F indControl("But ton1");
"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net> wrote in message news:O3******** ******@TK2MSFTN GP10.phx.gbl... > Being too lazy to load up VWD, try using: > FormView1.Row.F indControl("But ton1") > > In a repeater, you'd have multiple "Button1"'s and would need to look > at > repeater.Items[i].FindControl > > FormViews are the same..though there's only 1 row...so it's exposed as Row > (if I remember correctly). > > Karl > > -- > MY ASP.Net tutorials > http://www.openmymind.net/ - New and Improved (yes, the popup is > annoying) > http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to > come!) > "Daves" <db****@simnet. is> wrote in message > news:us******** ******@TK2MSFTN GP09.phx.gbl... >> hi, >> sorry for re-posting but it's a simple question and ought to have a very >> simple solution; I am trying to use Findcontrol to grab a Button control >> within a Formview control: >> >> <form ID="Form1" runat="server"> >> <asp:FormView ID="FormView1" Runat="server"> >> <ItemTemplate > >> <asp:Button ID="Button1" runat="server" Text="Breyta" > CommandName="Ed it"/> >> ... >> >> This is what won't work: >> Button Button1 = (Button) FormView1.FindC ontrol("Button1 "); >> >> > >
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: bill yeager |
last post by:
I have a datagrid control within a datalist control. When
I try and do a "Find" on the control, the object comes
back with nothing and then my pgm crashes. I am 100% sure
that my datagird inside my datalist has an id
of "Datagrid3". dgChild comes back with "Nothing" while
debugging.
Here is my code in the itemdatabound event for the
datalist:
<code>
|
by: bill yeager |
last post by:
I have a datalist displaying parent information and a
datagrid presenting child information. The data is being
rendered just fine. The datagrid has template columns on
it that I cannot gain access to in my Itemcommand event
of the datalist.
When I press a button on the datalist, that brings me
into the Itemcommand event. I have access to the datagrid
control, but not any column controls on the datagrid. For
instance, my first column is...
|
by: TM |
last post by:
What is the method used to find all asp.net server controls (run at server)
such as TextBox, ListBox, CheckBox... currently defined on an Asp.Net page
at run time. I need it inside of a controlled loop (for int i=...).
Reason: I need to fill up an updatable dataset with all fields entered on
the asp.net page instead of manually going 1 field at a time and hard code
the control name (i.e. TextBoxFirstName.Text=something and so on)
...
|
by: Jim Lambert |
last post by:
I have a form with custom controls. Each custom control contains a TextBox.
When I attempt to dynamically add a CompareValidator to a TextBox which
compares to a TextBox within the other custom control .NET throws the
exception: "Unable to find control id 'txt_element71' referenced by the
'ControlToCompare' property of 'valCompare_txt_element72'."
It appears that .NET can only support setting the ControlToCompare to a
control within...
|
by: Michael |
last post by:
I am running a web server (IIS) on Windows 2003 SP 1. My ASP.NET C#
applications run fine. However, my application is a combination of Classic
ASP and C#. For some reason when you attempt to access the Classic ASP
components of the application you are presented with this useless error
message: "The system cannot find the file specified"
The ASP.NET applications are contained within one directory, for instance...
| |
by: Amjad |
last post by:
Hi,
I just wrote a test Windows Service that creates a text file on startup
(please see my code below). The file is never created.
Protected Overrides Sub OnStart(ByVal args() As String)
Dim swLog As StreamWriter = File.CreateText("C:\myLog.txt")
swLog.WriteLine("My Windows Service has just started.")
swLog.Close() : swLog.Flush()
End Sub
|
by: wASP |
last post by:
Hi,
I'm having a problem referencing the elements within an object
after a method of that object (a member function) has been activated
with an onsubmit handler:
- - - - - - - - - - - - - -
- - - - - - - - - - - - - - -
<script language="javascript" type="text/javascript">
function js_onsubmit_hndl_fn ()
{
|
by: OJ |
last post by:
Hi,
I have added code to run on a button click event which adds
usercontrols to an asp:Panel control held in a contentplaceholder
defined by the masterpage.
for (int x = 0; x < (Master.PartyCtrl.Adults ); x++)
{
ASP.usercontrols_passenger_ascx passenger = new
ASP.usercontrols_passenger_ascx();
this.pnlAdults.Controls.Add(passenger);
|
by: Bruce |
last post by:
I am starting my first C## project. In one of my menu events I have the
following:
UserProfile winProfile = new UserProfile();
winProfile.Parent = this;
winProfile.Show();
UserProfile is a form, this is a MDI form.
|
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...
|
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,...
| |
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.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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...
|
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...
|
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();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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 we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |