I had a beautiful script that was running, well, just beautifully. But
then I decided to take a button that fired an event and place it inside
a <asp:table. The event WILL NOT FIRE INSIDE THE TABLE!?! When I move
the button outside the table, it works just fine. Inside the table, it
doesn't. What gives? 8 3880
Check the HTML tab to make sure that the Button control that fires the event
is placed inside <FORM>....</FORM>. Or perhaps, the "<asp:table " is not
within the "Form" boundary.
John
<ta*********@gm ail.com> wrote in message
news:11******** **************@ f14g2000cwb.goo glegroups.com.. . I had a beautiful script that was running, well, just beautifully. But then I decided to take a button that fired an event and place it inside a <asp:table. The event WILL NOT FIRE INSIDE THE TABLE!?! When I move the button outside the table, it works just fine. Inside the table, it doesn't. What gives?
Hi,
Post the table markup. There are many reasons. You could be missing a
quote or a bracket. If you cut and paste the button then the ID will
automatically change if you don't erase the button from where it was first.
Check that you have matching opening/closing cell and row brackets. If it
is a large table then create a small one row one cell table. Put the button
in there and make sure it fires. Once you have gained that confidence and
seen it work then start creating your larger table piece by piece until your
button stops working. Whatever you just did before it stopped working is
where your problem is. Be sure to post code or markup next time and you
will receive a much more accurate answer. Good luck! Ken.
--
Ken Dopierala Jr.
For great ASP.Net web hosting try: http://www.webhost4life.com/default.asp?refid=Spinlight
If you sign up under me and need help, email me.
<ta*********@gm ail.com> wrote in message
news:11******** **************@ f14g2000cwb.goo glegroups.com.. . I had a beautiful script that was running, well, just beautifully. But then I decided to take a button that fired an event and place it inside a <asp:table. The event WILL NOT FIRE INSIDE THE TABLE!?! When I move the button outside the table, it works just fine. Inside the table, it doesn't. What gives?
The button is definitely still inside the form, and nothing is being
erased and/or left behind when I move the button in and out of the
table. The procedure of moving the button isn't exactly what you'd
call complex. All I do is drag and drop the <asp:button> code in the
HTML viewer. The code behind the scenes still sees the button. I can
still reference and make visual changes to it. So the object is not
being hidden inside a <table> class somewhere. Why don't the events
fire?
Hi,
Post the code. Good luck! Ken.
--
Ken Dopierala Jr.
For great ASP.Net web hosting try: http://www.webhost4life.com/default.asp?refid=Spinlight
If you sign up under me and need help, email me.
<ta*********@gm ail.com> wrote in message
news:11******** *************@g 14g2000cwa.goog legroups.com... The button is definitely still inside the form, and nothing is being erased and/or left behind when I move the button in and out of the table. The procedure of moving the button isn't exactly what you'd call complex. All I do is drag and drop the <asp:button> code in the HTML viewer. The code behind the scenes still sees the button. I can still reference and make visual changes to it. So the object is not being hidden inside a <table> class somewhere. Why don't the events fire?
Ok, here is a sample script I created called test.aspx that shows what
I'm taking about. It's in two parts, the aspx and aspx.cs. Click the
button in the first box... and it works. The second one is exactly the
same except it's inside an <asp:table> and it doesn't work. The third
button will make changes to the objects in the <asp:table>.
//test.aspx
<%@ Page language="c#" Codebehind="tes t.aspx.cs"
AutoEventWireup ="false" Inherits="cafgs s.test" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>test</title>
<meta name="GENERATOR " Content="Micros oft Visual Studio .NET 7.1">
<meta name="CODE_LANG UAGE" Content="C#">
<meta name="vs_defaul tClientScript" content="JavaSc ript">
<meta name="vs_target Schema"
content="http://schemas.microso ft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING= "FlowLayout ">
<form id="Form1" method="post" runat="server">
<P>
<asp:TextBox id="TextBox1" runat="server"> </asp:TextBox>
<asp:Button id="Button1" runat="server" Text="Button Outside
Table"></asp:Button></P>
<asp:Table id="Table1" runat="server" GridLines="Both "
CellPadding="5" BorderStyle="So lid"
BorderColor="Bl ack">
<asp:TableRow >
<asp:TableCel l>
<asp:TextBox runat="server" ID="TextBox2"> </asp:TextBox>
<asp:Button runat="server" ID="Button2" Text="Button Inside
Table"></asp:Button>
</asp:TableCell>
</asp:TableRow>
</asp:Table>
</form>
<P>
<asp:Button id="Button3" runat="server" Text="Tease
Box"></asp:Button></P>
</body>
</HTML>
//test.aspx.cs
using System;
using System.Collecti ons;
using System.Componen tModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.Sess ionState;
using System.Web.UI;
using System.Web.UI.W ebControls;
using System.Web.UI.H tmlControls;
namespace cafgss
{
/// <summary>
/// Summary description for test.
/// </summary>
public class test : System.Web.UI.P age
{
protected System.Web.UI.W ebControls.Text Box TextBox1;
protected System.Web.UI.W ebControls.Tabl e Table1;
protected System.Web.UI.W ebControls.Butt on Button2;
protected System.Web.UI.W ebControls.Text Box TextBox2;
protected System.Web.UI.W ebControls.Butt on Button3;
protected System.Web.UI.W ebControls.Butt on Button1;
private void Page_Load(objec t sender, System.EventArg s e)
{
// Put user code to initialize the page here
}
#region Web Form Designer generated code
override protected void OnInit(EventArg s e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeCompo nent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeCompo nent()
{
this.Button1.Cl ick += new System.EventHan dler(this.Butto n1_Click);
this.Button3.Cl ick += new System.EventHan dler(this.Butto n3_Click);
this.Load += new System.EventHan dler(this.Page_ Load);
}
#endregion
private void Button1_Click(o bject sender, System.EventArg s e)
{
TextBox1.Text = "This works!";
}
private void Button2_Click(o bject sender, System.EventArg s e)
{
TextBox2.Text = "Does this one work?";
}
private void Button3_Click(o bject sender, System.EventArg s e)
{
TextBox2.Text = "I can play in the box";
Button2.Text = "I can reference you";
}
}
}
Hi,
Add this line between the other two in the InitializeCompo nent function:
this.Button2.Cl ick += new System.EventHan dler(this.Butto n2_Click);
By the way your Button3 is outside of your <Form> tags. Put it above the
</Form> tag or you'll have more problems. Good luck! Ken.
--
Ken Dopierala Jr.
For great ASP.Net web hosting try: http://www.webhost4life.com/default.asp?refid=Spinlight
If you sign up under me and need help, email me.
<ta*********@gm ail.com> wrote in message
news:11******** **************@ g14g2000cwa.goo glegroups.com.. . Ok, here is a sample script I created called test.aspx that shows what I'm taking about. It's in two parts, the aspx and aspx.cs. Click the button in the first box... and it works. The second one is exactly the same except it's inside an <asp:table> and it doesn't work. The third button will make changes to the objects in the <asp:table>.
//test.aspx <%@ Page language="c#" Codebehind="tes t.aspx.cs" AutoEventWireup ="false" Inherits="cafgs s.test" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > <HTML> <HEAD> <title>test</title> <meta name="GENERATOR " Content="Micros oft Visual Studio .NET 7.1"> <meta name="CODE_LANG UAGE" Content="C#"> <meta name="vs_defaul tClientScript" content="JavaSc ript"> <meta name="vs_target Schema" content="http://schemas.microso ft.com/intellisense/ie5"> </HEAD> <body MS_POSITIONING= "FlowLayout "> <form id="Form1" method="post" runat="server"> <P> <asp:TextBox id="TextBox1" runat="server"> </asp:TextBox> <asp:Button id="Button1" runat="server" Text="Button Outside Table"></asp:Button></P>
<asp:Table id="Table1" runat="server" GridLines="Both " CellPadding="5" BorderStyle="So lid" BorderColor="Bl ack"> <asp:TableRow > <asp:TableCel l> <asp:TextBox runat="server" ID="TextBox2"> </asp:TextBox> <asp:Button runat="server" ID="Button2" Text="Button Inside Table"></asp:Button> </asp:TableCell> </asp:TableRow> </asp:Table> </form> <P> <asp:Button id="Button3" runat="server" Text="Tease Box"></asp:Button></P> </body> </HTML>
//test.aspx.cs using System; using System.Collecti ons; using System.Componen tModel; using System.Data; using System.Drawing; using System.Web; using System.Web.Sess ionState; using System.Web.UI; using System.Web.UI.W ebControls; using System.Web.UI.H tmlControls;
namespace cafgss { /// <summary> /// Summary description for test. /// </summary> public class test : System.Web.UI.P age { protected System.Web.UI.W ebControls.Text Box TextBox1; protected System.Web.UI.W ebControls.Tabl e Table1; protected System.Web.UI.W ebControls.Butt on Button2; protected System.Web.UI.W ebControls.Text Box TextBox2; protected System.Web.UI.W ebControls.Butt on Button3; protected System.Web.UI.W ebControls.Butt on Button1;
private void Page_Load(objec t sender, System.EventArg s e) { // Put user code to initialize the page here }
#region Web Form Designer generated code override protected void OnInit(EventArg s e) { // // CODEGEN: This call is required by the ASP.NET Web Form Designer. // InitializeCompo nent(); base.OnInit(e); }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeCompo nent() { this.Button1.Cl ick += new System.EventHan dler(this.Butto n1_Click); this.Button3.Cl ick += new System.EventHan dler(this.Butto n3_Click); this.Load += new System.EventHan dler(this.Page_ Load);
} #endregion
private void Button1_Click(o bject sender, System.EventArg s e) { TextBox1.Text = "This works!"; }
private void Button2_Click(o bject sender, System.EventArg s e) { TextBox2.Text = "Does this one work?"; }
private void Button3_Click(o bject sender, System.EventArg s e) { TextBox2.Text = "I can play in the box"; Button2.Text = "I can reference you"; }
} }
Thanks, that did help. I swear I tried that before though. After
playing with it a little more, it would appear that the events are
automatically removed by Visual Studio every single time I make a
change to the HTML page in design mode. It's most annoying. So my
next question is, can that be stopped? This pile of junk is deleting
code that I add!!! Talk about nerve!
I'll suggest you to check if there is any item left in the"job list"(I'm
using Chinese version so you should find similiar name in English)
The IDE will find certain possible problem and add them there. If something
is left then the designer view can have problem to switch back to your code
view, and doing unsensible changes to your code because somehow you made it
think the changes make senses.
<ta*********@gm ail.com> ???
news:11******** **************@ g14g2000cwa.goo glegroups.com ???... Thanks, that did help. I swear I tried that before though. After playing with it a little more, it would appear that the events are automatically removed by Visual Studio every single time I make a change to the HTML page in design mode. It's most annoying. So my next question is, can that be stopped? This pile of junk is deleting code that I add!!! Talk about nerve! This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Stephen |
last post by:
I have the below asp table and I would like to be able to call up the
lblAddress1 label with in the asp table in the code behind page. I tried
doing this.lblAddress1 and it didn't work and I tried doing
this.tblSearchAddresses.lblAddress1 and it didn't work. Has anyone an idea
how I call this lable with a asp table. Thanks in advance for any help anyone
can give me.
<asp:table id="tblSearchAddresses" Runat="server" Width="100%">...
|
by: Kevin |
last post by:
I am just learning asp.net and ran into a problem that I have not been able
to resolve. I have a web form with an html table that houses an asp:label,
asp:textbox and asp:button within. I had the click event of the asp:button
working.
I then decided to drop an asp:table on the form and then added the three
component mentioned above into the asp:table. Now I cannot find a way to
set the click even of the asp:button anymore. In fact,...
|
by: Marty McDonald |
last post by:
I have <asp:Table... </asp:Table> on my webform. In codebehind, I populate
a DataTable whose data should appear in the asp:Table. I created my own
code to populate the asp:Table with the DataTable, then I discovered the
asp:Table has a DataBind method. But the method takes no args and so I'm
confused how to use it. Is there a link to see how DataBind works for
asp:Table? Should I just use my own code anyway? Thanks...
Here's my...
|
by: coleenholley |
last post by:
I asked the question yesterday:
> HI All :-)
>
> I don't know if I will be able to do this type of formatting, but what I
> need to do is have a table row where the text wraps (This is easy) the
first
> line of text is font size 10 pt and the second (wrapped text) is 6 pt. I
> know how to create a style sheet to get all of my font one size or the
> other, but does any one have any suggestions on how to do this?
|
by: Ed West |
last post by:
Hello,
How can I put a textbox control into a cell of an asp:Table? I was not
able to do it from the properties sheet, so I put it in via html tab,
but now I can't select it from the Design tab (nor select it from the
Properties tab on the right). Any ideas?
<asp:Table id="Table1" runat="server">
<asp:TableRow>
<asp:TableCell Text="Email:"></asp:TableCell>
| |
by: hb |
last post by:
Hi,
When I add an asp:button (ex: id=btnLog) on home.aspx,
I need to create btnLog_Click() event in home.aspx.cs,
and also link this event and the button in OnInit() method
by adding:
this.btnLog.Click +=new System.EventHandler(this.btnLog_Click);
Now, I need to generate some asp:button dynamically in
an asp:table, and assign the event to all buttons. But in
|
by: Davey P |
last post by:
I have an asp.net table which I am populating with controls dynamically at
runtime. The controls themselves get/set values in a datatable which is
stored in viewstate over postbacks. Here is basically what I am doing:
pull datatable out of viewstate
for each row in datatable
create tablerow
create tablecells
create controls
|
by: keithb |
last post by:
It looks like the span tag cannot be used with asp tables. What is the best
way to make an irregular asp table?
Thanks,
Keith
|
by: jonnyboy26 |
last post by:
I have a dynamically populated ASP table. One of the columns in every row is a checkbox. I want the user to be able to check a few of the boxes, then hit the 'update' button. Thus marking the records as done and removing them from the list. The problem I am having is that when the update button is clicked, it does a postback and the data in the table is lost. How can I get a button to not postback? Or how can I keep from losing the data in the...
|
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: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |