Professional Web Applications Themes

Client-side JavaScript code and ASP.NET controls - ASP.NET General

Hello, Is there any possibility using ASP.NET and Visual Studio.NET to create controls that response for simple JavaScript events such as OnClick and OnSelect? For example I need to change the color of a table cell when a certain button is selected. In this case there is no need to do a round-trip to the web server. I need to assign an event handler to the button's OnClick event. Does the VS.NET support this kind of events? Thanks for any suggestions, Leszek Taratuta...

  1. #1

    Default Client-side JavaScript code and ASP.NET controls

    Hello,

    Is there any possibility using ASP.NET and Visual Studio.NET to create
    controls that response for simple JavaScript events such as OnClick and
    OnSelect? For example I need to change the color of a table cell when a
    certain button is selected. In this case there is no need to do a round-trip
    to the web server. I need to assign an event handler to the button's OnClick
    event. Does the VS.NET support this kind of events?

    Thanks for any suggestions,
    Leszek Taratuta


    Leszek Guest

  2. #2

    Default Re: Client-side JavaScript code and ASP.NET controls

    It's the same with ASP.NET as it is with standard HTML - just add the
    onclick property to the markup of an input type=button. If you are using an
    asp:button (and I'm not sure why you would be, if you don't want the server
    to handle it, what is the point) then it actually does add an onclick
    attribute already, so this can lead to conflicts that some people have seen.
    If you need to dynamically insert script, just set runat=server and then use
    button.Attributes.Add to attach a script (or set any other attribute, for
    that matter).

    --
    Chris Jackson
    Software Engineer
    Microsoft MVP - Windows XP
    Windows XP Associate Expert
    --
    "Leszek" <com> wrote in message
    news:eLgGG%phx.gbl... 
    round-trip 
    OnClick 


    Chris Guest

  3. #3

    Default Re: Client-side JavaScript code and ASP.NET controls

    Thanks for your reply!
    Do you know where I can find a sample code to create such a control?

    Leszek Taratuta

    "Steve C. Orr, MCSD" <net> wrote in message
    news:phx.gbl... 
    control [/ref]
    VS.NET 
    > handlers [/ref]
    > such 
    > >[/ref]
    >[/ref]
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/ 
    > >[/ref]
    >[/ref]
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/ [/ref]
    > http://www.flws.com.au/showusyourcode/codeLib/code/NET_jsAddTo.asp?catID=5 [/ref][/ref]
    create [/ref]
    > and [/ref][/ref]
    when 
    > >
    > >[/ref]
    >
    >[/ref]


    Leszek Guest

  4. #4

    Default Re: Client-side JavaScript code and ASP.NET controls

    Hi Leszek,

    Based on my research, there is not an existed sample code in Microsoft Web
    Site. If you need sample code, I suggest you try Microsoft Advisory
    Service option. More detailed information regarding Microsoft Advisory
    Service can be found at the following link:

    http://support.microsoft.com/common/international.aspx?rdpath=fh;en-us;advis
    oryservice

    Best regards,

    Jacob Yang
    Microsoft Online Partner Support
    <MCSD>
    Get Secure! C www.microsoft.com/security
    This posting is provided "as is" with no warranties and confers no rights.

    Jacob Guest

  5. #5

    Default Re: Client-side JavaScript code and ASP.NET controls

    Thanks for your reply.
    I'll try to find such a control somewhere else, and then try the Microsoft
    Advisory Service.

    Thanks,
    Leszek Taratuta

    "Jacob Yang [MSFT]" <microsoft.com> wrote in message
    news:OazO$phx.gbl... 
    http://support.microsoft.com/common/international.aspx?rdpath=fh;en-us;advis 


    Leszek Guest

Similar Threads

  1. Client-Side Validation of asp:TextBox with Javascript
    By Matthew Wieder in forum ASP.NET General
    Replies: 3
    Last Post: March 10th, 04:08 PM
  2. Hit Counter in Javascript on client side.
    By aspen19 in forum Macromedia Dynamic HTML
    Replies: 4
    Last Post: August 8th, 01:04 PM
  3. Controls with a client side onLoad function or seting a cursor server side
    By Geoff Davis in forum ASP.NET Building Controls
    Replies: 3
    Last Post: January 15th, 03:54 AM
  4. Cannot enable disabled controls with client-side javascript
    By Stu Carter in forum ASP.NET General
    Replies: 6
    Last Post: August 14th, 03:28 PM
  5. how can i add client side javascript to a web user control?
    By Tariq Ahmad in forum ASP.NET General
    Replies: 2
    Last Post: July 10th, 11:36 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139