open a new window with ajax reorder list

Discussion in 'ASP .Net Web Controls' started by Haim, Jan 29, 2009.

  1. Haim

    Haim Guest

    I have a web page with the reorderlist web control containing a link button
    in the item template. The result of the click is dependent upon a radio
    button selection made prior to the link button click. The user can update a
    text field depending upon the value of the link button, or I would like to
    open a different aspx page in a new window (Code Behind of Link button event
    attached). I have no problems updating the literal field, and only the
    literal field is refreshed. But when I try to open a new window I get the
    following script error on the page:
    "Sys.WebForms.pagerequestmanagerParserErrorException: The message received
    from the server could not be parsed."
    If I do not use an update panel, the code works fine. Or if I add a
    triggers section to the update panel the code will also work, but I loose
    the partial refresh when I update the text field (entire page refreshes).
    This is my first attempt at an Ajax enabled web page. I assume proper
    javascript will work better than my code below. Can someone give me some
    hints how to capture the click in javascript so that I can run the code?

    Page Source
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager><asp:UpdatePanel ID="UpdatePanel2"

    <asp:DropDownList ID="PanelDDl" runat="server" Height="41px"
    AutoPostBack="True" DataSourceID="PanelDS"
    <cc1:DropDownExtender ID="PanelDDl_DropDownExtender" runat="server"
    DynamicServicePath="" Enabled="True"
    TargetControlID="PanelDDl" >
    <cc1:ReorderList ID="ReorderList1" runat="server"
    PostBackOnReorder="False" Width="196px"
    DataKeyField="Counter" >
    <asp:LinkButton ID="LinkButton1"
    runat="server" text='<%# Eval("Counter")%>'
    (won't work at all without this template)
    <asp:ObjectDataSource ID="PanelListds"
    <asp:ControlParameter ControlID="PanelDDl"
    Type="String" />
    (If I put a trigger here, the code will open a new window, but I
    get a full refresh of this page for the other functions.)

    Code Behind for Linkbutton
    Protected Sub LinkButton1_Click(ByVal sender As Object, ByVal e As
    Dim myref As New GetsinglePanel.GetReview
    Select Case RadioButtonList1.SelectedValue
    Case "Reviews"
    ' Updates literal field on page - this works in all cases
    Case "Proposal"
    'Want to open an aspx page in a new window based on value
    clicked in list
    Dim myscript As String
    myscript = "<script language='javascript'
    myscript += "" & _
    "'DLProp.aspx?counter=" & sender.text &
    myscript += "</script>"
    "myscript", myscript)
    End Select

    End Sub
    Haim, Jan 29, 2009
    1. Advertisements

  2. Hello Haim,

    Based on my understanding, you have a DropDownList to handle the
    LinkButton functionality. But it didn't execute the JavaScript you
    registered from the server-side. If I have misunderstood you, please feel
    free to let me know.

    I think the problem is that script register is not in the right way. Within
    UpdatePanel, we can't use Response.Write or Server.Transfer, otherwise we
    will encounter the error
    "Sys.WebForms.PageRequestManagerParserErrorException" . If you want to get
    further information about it, you can check the below link:

    In this case, neither Response.Write nor ClientScript can be used to
    register the JavaScript to the client. I suggest you use
    ScriptManager.RegisterStartupScript to do it. It will work within

    Please try to modify the existing code as following to see if it works:

    Case "Proposal"
    Dim myscript As String
    myscript = "" & _
    "'DLProp.aspx?counter=" & sender.Text &
    ScriptManager. RegisterStartupScript(Me,Me.GetType(),
    "myscript", myscript, True)


    Vince Xu

    Microsoft Online Support

    Get notification to my posts through email? Please refer to

    MSDN Managed Newsgroup support offering is for non-urgent issues where an
    initial response from the community or a Microsoft Support Engineer within
    2 business day is acceptable. Please note that each follow up response may
    take approximately 2 business days as the support professional working with
    you may need further investigation to reach the most efficient resolution.
    The offering is not appropriate for situations that require urgent,
    real-time or phone-based interactions. Issues of this nature are best
    handled working with a dedicated Microsoft Support Engineer by contacting
    Microsoft Customer Support Services (CSS) at
    Vince Xu [MSFT], Jan 30, 2009
    1. Advertisements

  3. Haim

    Haim Guest

    Dear Vince,
    Thank you very much for your informative and helpful post. Your code solved
    this problem.

    Haim, Feb 1, 2009
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.