writing html (client) on aspx

Discussion in 'ASP .Net' started by Avi, May 5, 2005.

  1. Avi

    Avi Guest

    Hello,

    How can I (on Microsoft Visual studio .NET 2003) :
    use HTML code on aspx page
    (I have a button, and I want that the event occurs, when I am clicking on
    it,
    the IDE doesn't let me doing so, and there is a message : ... it must be
    converted to HTML.
    I want that the button will run on the client, and I know that a aspx page
    can act as a simple html page,
    so I can do that on aspx page (on the client side) )
    How can I make an event on the button on both server & client side (with
    some configuration on the Microsoft visual studio .NET 2003) ?

    Thanks :)
    Avi, May 5, 2005
    #1
    1. Advertising

  2. Avi

    Mona Guest

    Hi Avi,

    In your ASPX code, make the button as you normally would, but add an onServerClick attribute,
    an id attribute and a runat="server" attribute as follows:

    <input type="button" onserverclick="MyFunction" onclick="javascript:alert('Something happened.');
    "id="btnButton1" runat="server" value="Go">

    In the codebehind for the page, put

    Public Sub MyFunction(ByVal sender As System.Object, ByVal e As System.EventArgs)

    Response.Write("From the server.")

    End Sub

    And now this button will respond to events both on the client side and server side.

    HTH

    Mona[Grapecity]


    "Avi" <nobody@nospam_please.com> wrote in message news:Oc0QX$...
    > Hello,
    >
    > How can I (on Microsoft Visual studio .NET 2003) :
    > use HTML code on aspx page
    > (I have a button, and I want that the event occurs, when I am clicking on
    > it,
    > the IDE doesn't let me doing so, and there is a message : ... it must be
    > converted to HTML.
    > I want that the button will run on the client, and I know that a aspx page
    > can act as a simple html page,
    > so I can do that on aspx page (on the client side) )
    > How can I make an event on the button on both server & client side (with
    > some configuration on the Microsoft visual studio .NET 2003) ?
    >
    > Thanks :)
    >
    >
    Mona, May 5, 2005
    #2
    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. Mr. x
    Replies:
    1
    Views:
    1,951
    John Timney \(Microsoft MVP\)
    Nov 30, 2003
  2. HNguyen
    Replies:
    4
    Views:
    2,388
    HNguyen
    Dec 21, 2004
  3. Paolo Pignatelli
    Replies:
    6
    Views:
    2,166
    Paolo Pignatelli
    Feb 21, 2005
  4. John M
    Replies:
    1
    Views:
    1,115
    Kumar Reddi
    May 29, 2005
  5. Biffo
    Replies:
    1
    Views:
    525
    Bob Barrows
    Apr 10, 2009
Loading...

Share This Page