473,320 Members | 1,804 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

how to trigger action from button embedded in another control?

Hi,
I have a button ("button1") embedded into another control ("LoginView1"). In
the code-behind environment of VWD (visual web

dev.), i cant' use the event button1_onclick because 'button1' doesn't
appear in the list of the events.
How can i then trigger an action when clicking the button?

Thanks again
Cliff

aspx:
----
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
<table>
<asp:LoginView ID="LoginView1" runat="server">
<LoggedInTemplate>
<fieldset style="height: 425px; width: 335px;">
<tr><td>
<tr><td><asp:Button ID="Button1" runat="server" Text="Click here
/></td></tr>
</td></tr>
</fieldset>
</LoggedInTemplate>
</asp:LoginView>
</table>
</asp:Content>

Feb 15 '07 #1
3 2208
You could just add an event handler to it at aspx

<asp:Button ID="Button1" runat="server" Text="Button"
OnClick="Button1_Click" />

then in code

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs)

End Sub
--
Teemu Keiski
AspInsider, ASP.NET MVP
http://blogs.aspadvice.com/joteke
http://teemukeiski.net


"Terry" <no@mail.prwrote in message
news:O2**************@TK2MSFTNGP06.phx.gbl...
Hi,
I have a button ("button1") embedded into another control ("LoginView1").
In the code-behind environment of VWD (visual web

dev.), i cant' use the event button1_onclick because 'button1' doesn't
appear in the list of the events.
How can i then trigger an action when clicking the button?

Thanks again
Cliff

aspx:
----
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
<table>
<asp:LoginView ID="LoginView1" runat="server">
<LoggedInTemplate>
<fieldset style="height: 425px; width: 335px;">
<tr><td>
<tr><td><asp:Button ID="Button1" runat="server" Text="Click here
/></td></tr>
</td></tr>
</fieldset>
</LoggedInTemplate>
</asp:LoginView>
</table>
</asp:Content>
Feb 15 '07 #2
Two ways:
1. switch to designer, hover around loginview, you shall see a small black
arrow, click to expand the LoginView Tasks,
select 'views' from combo box, and you'll see you temaplte with button,
double click on the button - designer will generate handler code.
2. in template declaration:
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click"
Text="Button" />
and code beside/behind (make sure autoeventwireuop is switched on')

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs)

End Sub
--
Milosz
"Terry" wrote:
Hi,
I have a button ("button1") embedded into another control ("LoginView1"). In
the code-behind environment of VWD (visual web

dev.), i cant' use the event button1_onclick because 'button1' doesn't
appear in the list of the events.
How can i then trigger an action when clicking the button?

Thanks again
Cliff

aspx:
----
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
<table>
<asp:LoginView ID="LoginView1" runat="server">
<LoggedInTemplate>
<fieldset style="height: 425px; width: 335px;">
<tr><td>
<tr><td><asp:Button ID="Button1" runat="server" Text="Click here
/></td></tr>
</td></tr>
</fieldset>
</LoggedInTemplate>
</asp:LoginView>
</table>
</asp:Content>

Feb 15 '07 #3
Thanks both ...

"Milosz Skalecki [MCAD]" <mi*****@DONTLIKESPAMwp.plschreef in bericht
news:19**********************************@microsof t.com...
Two ways:
1. switch to designer, hover around loginview, you shall see a small black
arrow, click to expand the LoginView Tasks,
select 'views' from combo box, and you'll see you temaplte with button,
double click on the button - designer will generate handler code.
2. in template declaration:
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click"
Text="Button" />
and code beside/behind (make sure autoeventwireuop is switched on')

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs)

End Sub
--
Milosz
"Terry" wrote:
>Hi,
I have a button ("button1") embedded into another control ("LoginView1").
In
the code-behind environment of VWD (visual web

dev.), i cant' use the event button1_onclick because 'button1' doesn't
appear in the list of the events.
How can i then trigger an action when clicking the button?

Thanks again
Cliff

aspx:
----
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
<table>
<asp:LoginView ID="LoginView1" runat="server">
<LoggedInTemplate>
<fieldset style="height: 425px; width: 335px;">
<tr><td>
<tr><td><asp:Button ID="Button1" runat="server" Text="Click here
/></td></tr>
</td></tr>
</fieldset>
</LoggedInTemplate>
</asp:LoginView>
</table>
</asp:Content>


Feb 15 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Manoj S. P. | last post by:
Hi Folks, My basic requirement is I want to write a trigger on a table based on certain conditions post-update from another table in another database. The actors in this scenario are:...
7
by: rkrueger | last post by:
Given the following 3 Tables: CREATE TABLE ( NOT NULL , NOT NULL CONSTRAINT DEFAULT (getdate()), NULL , CONSTRAINT PRIMARY KEY CLUSTERED (
2
by: Owin | last post by:
Hi all, I've created an User control. It's an extension of a textbox wich has some extra properties so that validation becomes a lot faster. The control wordks great if autopostback is on. When...
5
by: Peter Erickson | last post by:
I am running postgresql 7.4.2 and having problems creating a trigger function properly. I keep getting the following error: ERROR: OLD used in query that is not in rule I have a table called...
0
by: Ben S | last post by:
vs2005, .net fw 2.0 the questions is, how can I cause the label to change in my client page triggered by an event raised from the user control which is on my master page. I have a master page...
3
by: jerryau | last post by:
Hi, Does anyone know how can I find what was the action trigger (button pressed) at Page_Load? Because the Page_Load method is called first everytime anything is posted to the server, I need to...
1
by: koraykazgan | last post by:
Hi all, I have a user control (ASCX). In that user control there is a panel, and inside that panel there is a textbox and a button. The panel has a DefaultButton property set, which is set to the...
2
by: maralfarshadi | last post by:
Hello In my JSP, I have several comboboxes (located in several forms in one JSP). In the onChange event , I have : onchange="submit()" My combobox have the values : Select Item Action 1...
1
by: zb | last post by:
Scenarion: In an ASPX page I have a user control embedded (actually embedded in MasterPage), based on completion of a AJAX call in the user control it needs to update a Grid view which is actually...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
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...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.