Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > how to trigger action from button embedded in another control?

Reply
Thread Tools

how to trigger action from button embedded in another control?

 
 
Terry
Guest
Posts: n/a
 
      02-15-2007
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>



 
Reply With Quote
 
 
 
 
Teemu Keiski
Guest
Posts: n/a
 
      02-15-2007
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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>
>
>
>


 
Reply With Quote
 
 
 
 
Milosz Skalecki [MCAD]
Guest
Posts: n/a
 
      02-15-2007
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>
>
>
>
>

 
Reply With Quote
 
Terry
Guest
Posts: n/a
 
      02-15-2007
Thanks both ...

"Milosz Skalecki [MCAD]" <(E-Mail Removed)> schreef in bericht
news:(E-Mail Removed)...
> 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>
>>
>>
>>
>>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
disabling the ENTER button to trigger a button? paul814@excite.com HTML 2 05-15-2008 03:28 PM
Can we call an Action from another Action in struts??? vyshu Java 1 04-27-2007 09:19 AM
how to trigger action from button embedded in another control? Terry ASP .Net 3 02-15-2007 05:32 PM
How Trigger Action When Application is Shut Down? johnhurt@gmail.com Java 0 05-04-2006 11:55 PM



Advertisments