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 4925
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: 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,...
|
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
| |
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: 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...
|
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: 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...
| |