|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
open a new window with ajax reorder listin 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" runat="server"> <ContentTemplate> <asp:DropDownList ID="PanelDDl" runat="server" Height="41px" Width="202px" AutoPostBack="True" DataSourceID="PanelDS" DataTextField="PanelFullName" DataValueField="OldPanelShortName"> </asp:DropDownList> <cc1:DropDownExtender ID="PanelDDl_DropDownExtender" runat="server" DynamicServicePath="" Enabled="True" TargetControlID="PanelDDl" > </cc1:DropDownExtender> <cc1:ReorderList ID="ReorderList1" runat="server" PostBackOnReorder="False" Width="196px" DataSourceID="PanelListds" DataKeyField="Counter" > <ItemTemplate> <asp:LinkButton ID="LinkButton1" runat="server" text='<%# Eval("Counter")%>' onclick="LinkButton1_Click"></asp:LinkButton> </ItemTemplate> <DragHandleTemplate> </DragHandleTemplate> (won't work at all without this template) </cc1:ReorderList> <asp:ObjectDataSource ID="PanelListds" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="GetData" TypeName="ProposalCountersTableAdapters.GetProposalforAbstractbyPanelTableAdapter"> <SelectParameters> <asp:ControlParameter ControlID="PanelDDl" Name="panel" PropertyName="SelectedValue" Type="String" /> </SelectParameters> </asp:ObjectDataSource> </ContentTemplate> (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.) </asp:UpdatePanel> Code Behind for Linkbutton Protected Sub LinkButton1_Click(ByVal sender As Object, ByVal e As System.EventArgs) 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' type='text/javascript'>" myscript += "window.open(" & _ "'DLProp.aspx?counter=" & sender.text & "','win','toolbar=0,location=0,directories=0,status=1,menubar=1,scrollbars=1,resizable=1');" myscript += "</script>" Me.ClientScript.RegisterClientScriptBlock(Me.GetType(), "myscript", myscript) or System.Web.HttpContext.Current.Response.Write(myscript) End Select End Sub 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: http://weblogs.asp.net/leftslipper/archive/2007/02/26/sys-webforms-pagereque stmanagerparsererrorexception-what-it-is-and-how-to-avoid-it.aspx 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 UpdatePanel. Please try to modify the existing code as following to see if it works: Case "Proposal" Dim myscript As String myscript = "window.open(" & _ "'DLProp.aspx?counter=" & sender.Text & "','win','toolbar=0,location=0,directories=0,status=1,menubar=1,scrollbars=1 ,resizable=1');" ScriptManager. RegisterStartupScript(Me,Me.GetType(), "myscript", myscript, True) Sincerely, Vince Xu Microsoft Online Support ================================================== Get notification to my posts through email? Please refer to http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications. 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 http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx ================================================== Dear Vince,
Thank you very much for your informative and helpful post. Your code solved this problem. Haim -- Show quoteHide quoteHaim Katz BARD "Vince Xu [MSFT]" wrote: > 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: > http://weblogs.asp.net/leftslipper/archive/2007/02/26/sys-webforms-pagereque > stmanagerparsererrorexception-what-it-is-and-how-to-avoid-it.aspx > > 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 > UpdatePanel. > > Please try to modify the existing code as following to see if it works: > > Case "Proposal" > Dim myscript As String > myscript = "window.open(" & _ > "'DLProp.aspx?counter=" & sender.Text & > "','win','toolbar=0,location=0,directories=0,status=1,menubar=1,scrollbars=1 > ,resizable=1');" > ScriptManager. RegisterStartupScript(Me,Me.GetType(), > "myscript", myscript, True) > > > > Sincerely, > > Vince Xu > > Microsoft Online Support > > ================================================== > Get notification to my posts through email? Please refer to > http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications. > > 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 > http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx > ================================================== > >
Email
GridView Hyperlink field OnClientClick="javascript:enableValidators(....) error Using the ImageUrl property of the HyperLink control Time tracking software with asp.net source code Need help for solution in ASP.NET with VB Unnecessary spaces when rendering list controls Link Button - Text on 2 lines RegularExpressionValidator problem Finding new record in DetailsView with ObjectDataSource |
|||||||||||||||||||||||