SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Hybrid View

  1. #1
    SitePoint Guru
    Join Date
    Dec 2008
    Posts
    692
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    syntax error not located

    i have a html control


    <input name="test" type="hidden" id="test" runat="server" />

    in asp.net when i execute the application i am getting syntax error at the above line which contains this control i am unabel to locate the error . how do i locate it when this control has value it works fine but if it does not have value it gives the error msg i even checked for if else condition if it has value it goes in the deugging sequence it no value it just gives the error msg and all this event for getting the value is given on a button click

  2. #2
    SitePoint Enthusiast
    Join Date
    Mar 2009
    Location
    England
    Posts
    37
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It would be nice to know what the error msg says, so that we can determin the source, whether its comming from javascript code or .net code.

    Either way, it is always possible to place an if statements to check for nulls, before the error is raised. If it was the other way around, I think the rest of us would have noticed by now.

  3. #3
    SitePoint Guru
    Join Date
    Dec 2008
    Posts
    692
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    it just says syntax error at a particular line . if i check that line when the code is executed that is the rendered htmlpage the cursor point to tthe line having the above html control

  4. #4
    SitePoint Mentor NightStalker-DNS's Avatar
    Join Date
    Jul 2004
    Location
    Cape Town, South Africa
    Posts
    2,868
    Mentioned
    37 Post(s)
    Tagged
    0 Thread(s)
    <input name="test" type="hidden" id="test" runat="server" value="" />

    Try that so it has a default value of an empty string. But if the problem is assigning value or getting value from it, then it will not show the error on an aspx line

    Would show u the line on the .cs page that is trying to access it.

    Try using the asp:Hidden field instead

  5. #5
    SitePoint Guru
    Join Date
    Dec 2008
    Posts
    692
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i found th source of the error
    i have made a function for alert box
    and then used register script in the pages

    if i use
    Page.RegisterStartupScript("Alert", PopUp)
    i get the alert message in case of any null value or error in the code

    but when i build the solution i get the follwing in the warnigs

    Warning 1 'Public Overridable Sub RegisterStartupScript(key As String, script As String)' is obsolete: 'The recommended alternative is ClientScript.RegisterStartupScript(Type type, string key, string script). http://go.microsoft.com/fwlink/?linkid=14202'


    so if i use
    Page.ClientScript.RegisterStartupScript(Page.GetType(), "Alert", PopUp, True)

    i dont get the warning msg but i get the error any where in the aspx page as the alert box doesnot popup


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
  •