how to trigger action from button embedded in another control?

Discussion in 'ASP .Net' started by Terry, Feb 15, 2007.

  1. Terry

    Terry Guest

    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, Feb 15, 2007
    #1
    1. Advertising

  2. Terry

    Teemu Keiski Guest

    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" <> wrote in message
    news:...
    > 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, Feb 15, 2007
    #2
    1. Advertising

  3. 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>
    >
    >
    >
    >
     
    =?Utf-8?B?TWlsb3N6IFNrYWxlY2tpIFtNQ0FEXQ==?=, Feb 15, 2007
    #3
  4. Terry

    Terry Guest

    Thanks both ...

    "Milosz Skalecki [MCAD]" <> schreef in bericht
    news:...
    > 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, Feb 15, 2007
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    356
  2. =?Utf-8?B?QmVuIFM=?=
    Replies:
    0
    Views:
    547
    =?Utf-8?B?QmVuIFM=?=
    May 9, 2006
  3. vyshu
    Replies:
    1
    Views:
    2,556
    Richard Senior
    Apr 27, 2007
  4. Replies:
    2
    Views:
    776
    Jonathan N. Little
    May 15, 2008
  5. Terry
    Replies:
    3
    Views:
    145
    Terry
    Feb 15, 2007
Loading...

Share This Page