how to trigger action from button embedded in another control?


T

Terry

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>
 
Ad

Advertisements

T

Teemu Keiski

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
 
G

Guest

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
 
Ad

Advertisements

T

Terry

Thanks both ...

Milosz Skalecki said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top