why doesn't this script creation, from .aspx.vb work, for this event handler???

Discussion in 'ASP .Net' started by Daniel Bass, Jul 3, 2003.

  1. Daniel Bass

    Daniel Bass Guest

    where szStartDate, szEndDate, szStatus, szMsgType,
    szClient, szFilter are all strings declared and
    containing data as this code executes...

    ' hook up a refresh event to the refresh button

    Dim RefreshScript As New System.Text.StringBuilder
    RefreshScript.Append("<SCRIPT
    language=""javascript"">")
    RefreshScript.Append("function RefreshGrid(
    szStartDate, szEndDate, szStatus, szMsgType, szClient,
    szFilter )")
    RefreshScript.Append("{")
    RefreshScript.Append(" alert( ""HOOTS
    ALORS!!!"" );")
    RefreshScript.Append(" var url
    = ""overview.aspx?StartDate="",
    szStartDate, ""&EndDate="", szEndDate, ""&Status="",
    szStatus,""&MsgType="", szMsgType,""&Client="",
    szClient,""&Filter="", szFilter ;""")
    RefreshScript.Append(" alert ( "" The URL to
    be refreshed iiiissssssss...."");")
    RefreshScript.Append(" alert ( url ); ")
    RefreshScript.Append("
    parent.overview.location.href = url; ")
    RefreshScript.Append("}")
    RefreshScript.Append("</SCRIPT>")

    RegisterClientScriptBlock("RefreshScript",
    RefreshScript.ToString)

    Dim ProcCall = "javascript:RefreshGrid( """ &
    szStartDate & """, """ & _
    szEndDate
    & """, """ & _
    szStatus
    & """, """ & _
    szMsgType
    & """, """ & _
    szClient
    & """, """ & _
    szFilter
    & """ );"
    btnRefresh.Attributes("onclick") = ProcCall



    clicking on the button, "btnRefresh" does nothing.
    all i'm trying to do is get a the "overview" frame to
    refresh with the listed frames, calling upto the parent,
    then back down to the frame in question.

    i don't even get the first alert to fire off, so the
    function's not even being entered.
    i've tried :
    - executing the function with no parameters present
    - putting the script in script tags on the aspx page

    at best if i replace the call to the function with just
    an "alert..." call in the attributes.add call, i see the
    alert, but only when pressing the button a second time???
    why is that?!?!

    Thanks!
    Dan.
     
    Daniel Bass, Jul 3, 2003
    #1
    1. Advertising

  2. Daniel Bass

    Daniel Bass Guest

    formatted better... why doesn't this script creation, from .aspx.vb work, for this event handler???

    where szStartDate, szEndDate, szStatus, szMsgType,
    szClient, szFilter are all strings declared and
    containing data as this code executes...

    ' hook up a refresh event to the refresh button

    Dim RefreshScript As New System.Text.StringBuilder
    RefreshScript.Append("<SCRIPT language=""javascript"">")
    RefreshScript.Append("function RefreshGrid( szStartDate, szEndDate, szStatus, szMsgType, szClient, szFilter )")
    RefreshScript.Append("{")
    RefreshScript.Append(" alert( ""HOOTS ALORS!!!"" );")
    RefreshScript.Append(" var url = ""overview.aspx?StartDate="", szStartDate, ""&EndDate="", szEndDate, ""&Status="", szStatus,""&MsgType="", szMsgType,""&Client="", szClient,""&Filter="", szFilter ;""")
    RefreshScript.Append(" alert ( "" The URL to be refreshed iiissssssss...."");")
    RefreshScript.Append(" alert ( url ); ")
    RefreshScript.Append(" parent.overview.location.href = url; ")
    RefreshScript.Append("}")
    RefreshScript.Append("</SCRIPT>")

    RegisterClientScriptBlock("RefreshScript", RefreshScript.ToString)

    Dim ProcCall = "javascript:RefreshGrid( """ & szStartDate & """, """ & _
    szEndDate & """, """ & _
    szStatus & """, """ & _
    szMsgType & """, """ & _
    szClient & """, """ & _
    szFilter & """ );"
    btnRefresh.Attributes("onclick") = ProcCall



    clicking on the button, "btnRefresh" does nothing.
    all i'm trying to do is get a the "overview" frame to
    refresh with the listed frames, calling upto the parent,
    then back down to the frame in question.

    i don't even get the first alert to fire off, so the
    function's not even being entered.
    i've tried :
    - executing the function with no parameters present
    - putting the script in script tags on the aspx page

    at best if i replace the call to the function with just
    an "alert..." call in the attributes.add call, i see the
    alert, but only when pressing the button a second time???
    why is that?!?!

    Thanks!
    Dan.
     
    Daniel Bass, Jul 3, 2003
    #2
    1. Advertising

  3. Daniel Bass

    Daniel Bass Guest

    "Marina" <> wrote in message
    news:...
    > Have you looked at the rendered HTML to see what it looks like?


    yep, i took the HTML text I originally put in and just placed quotes around
    it... i moved it here because i wasn't sure if the aspx page was in the
    scope of the aspx.vb page.

    > Is the client side event handler being registered properly?


    i don't know, how do i tell?


    > Does the HTML look the way it is supposed to?


    yep.
     
    Daniel Bass, Jul 3, 2003
    #3
  4. Daniel Bass

    Marina Guest

    Well, you can tell if everything is registered properly by looking at the
    HTML and seeing if the onclick handler is pointing to the right function
    etc. By looking at your function and making sure it's valid javascript.

    If your page is then not behaving normally, then this is a
    browser/javascript issue, not an ASP.NET issue. Once this stuff is on the
    client, asp.net is not involved. If your javascript is right, and the
    button's onclick handler is set correctly, and things are still not
    functioning properly - then asp.net is not involved.

    "Daniel Bass" <> wrote in message
    news:...
    >
    > "Marina" <> wrote in message
    > news:...
    > > Have you looked at the rendered HTML to see what it looks like?

    >
    > yep, i took the HTML text I originally put in and just placed quotes

    around
    > it... i moved it here because i wasn't sure if the aspx page was in the
    > scope of the aspx.vb page.
    >
    > > Is the client side event handler being registered properly?

    >
    > i don't know, how do i tell?
    >
    >
    > > Does the HTML look the way it is supposed to?

    >
    > yep.
    >
    >
     
    Marina, Jul 3, 2003
    #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. Mr. SweatyFinger

    why why why why why

    Mr. SweatyFinger, Nov 28, 2006, in forum: ASP .Net
    Replies:
    4
    Views:
    974
    Mark Rae
    Dec 21, 2006
  2. Mr. SweatyFinger
    Replies:
    2
    Views:
    2,213
    Smokey Grindel
    Dec 2, 2006
  3. Replies:
    1
    Views:
    748
    Damien
    Feb 22, 2007
  4. Replies:
    0
    Views:
    167
  5. Chris

    event handler in <body> doesn't work

    Chris, Nov 2, 2009, in forum: Javascript
    Replies:
    2
    Views:
    141
    Lasse Reichstein Nielsen
    Nov 2, 2009
Loading...

Share This Page