SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Evangelist
    Join Date
    May 2006
    Posts
    457
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    illegal XML charater

    hello all, im trying to get a javascript function to fire a click event for a button. As im using aspnet, there is a method that enables me to fire the click event of a button (Page.GetPostBackEventReference(SaveButton)).

    Ive tried using the follwing within my javascipt code, but with no luck:

    Code:
    <%= Page.GetPostBackEventReference(SaveButton); %>
    however, when dubugging using the javascript console in firefox, i get the following error: "Illegal XML charater".

    where am i going wrong? Hopw can i get the line of asp.net code to execute successfully within javascipt?

    Many thanks

  2. #2
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,181
    Mentioned
    191 Post(s)
    Tagged
    2 Thread(s)

    asp.net inside js

    I don't have any experience with ASP.NET but I imagine it's similar to PHP in that it's a server-side language. In other words, you can use it to put values inside the rendered javascript, but it won't run on the users machine.
    Maybe there's some VBScript instead that will do what you want?

  3. #3
    SitePoint Wizard gRoberts's Avatar
    Join Date
    Oct 2004
    Location
    Birtley, UK
    Posts
    2,439
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That should of been rendered or returned an ASP.Net Error.

    If javascript see's this then your ASP.Net code isn't being parsed/rendered.

    As for this problem, I replied to your other thread (fire event when user presses enter) and replaced the above code with:

    Code:
    <% Response.Write(Page.GetPostBackEventReference(button)); %>

    I know Response.Write is frowned upon but for all intensive purposes it will be used to make sure your page is rendering ASP.Net properly.



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
  •