Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net Web Controls (http://www.velocityreviews.com/forums/f63-asp-net-web-controls.html)
-   -   how to trigger action from button embedded in another control? (http://www.velocityreviews.com/forums/t779596-how-to-trigger-action-from-button-embedded-in-another-control.html)

Terry 02-15-2007 08:38 AM

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>




Teemu Keiski 02-15-2007 01:12 PM

Re: how to trigger action from button embedded in another control?
 
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.pr> wrote in message
news:O26VAzNUHHA.1364@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>
>
>
>



Milosz Skalecki [MCAD] 02-15-2007 03:07 PM

RE: how to trigger action from button embedded in another control?
 
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>
>
>
>
>


Terry 02-15-2007 05:32 PM

Re: how to trigger action from button embedded in another control?
 
Thanks both ...

"Milosz Skalecki [MCAD]" <mily242@DONTLIKESPAMwp.pl> schreef in bericht
news:193F2506-B82C-4E61-97BB-8FF413DF73F6@microsoft.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>
>>
>>
>>
>>





All times are GMT. The time now is 05:06 AM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57