Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > open a new window with ajax reorder list

Reply
Thread Tools

open a new window with ajax reorder list

 
 
Haim
Guest
Posts: n/a
 
      01-29-2009
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.pagerequestmanagerParserErrorExcepti on: 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>

<aspropDownList ID="PanelDDl" runat="server" Height="41px"
Width="202px"
AutoPostBack="True" DataSourceID="PanelDS"
DataTextField="PanelFullName"
DataValueField="OldPanelShortName">
</aspropDownList>
<cc1ropDownExtender ID="PanelDDl_DropDownExtender" runat="server"
DynamicServicePath="" Enabled="True"
TargetControlID="PanelDDl" >
</cc1ropDownExtender>
<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>&nbsp;</DragHandleTemplate>
(won't work at all without this template)
</cc1:ReorderList>
<asp:ObjectDataSource ID="PanelListds"
runat="server"
OldValuesParameterFormatString="original_{0}"
SelectMethod="GetData"
TypeName="ProposalCountersTableAdapters.GetProposa lforAbstractbyPanelTableAdapter">
<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,statu s=1,menubar=1,scrollbars=1,resizable=1');"
myscript += "</script>"
Me.ClientScript.RegisterClientScriptBlock(Me.GetTy pe(),
"myscript", myscript)
or
System.Web.HttpContext.Current.Response.Write(mysc ript)
End Select

End Sub


 
Reply With Quote
 
 
 
 
Vince Xu [MSFT]
Guest
Posts: n/a
 
      01-30-2009
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.PageRequestManagerParserErrorExcepti on" . If you want to get
further information about it, you can check the below link:
http://weblogs.asp.net/leftslipper/a...orms-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,statu s=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/subs...#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/subs.../aa948874.aspx
==================================================

 
Reply With Quote
 
 
 
 
Haim
Guest
Posts: n/a
 
      02-01-2009
Dear Vince,
Thank you very much for your informative and helpful post. Your code solved
this problem.

Haim
--
Haim 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.PageRequestManagerParserErrorExcepti on" . If you want to get
> further information about it, you can check the below link:
> http://weblogs.asp.net/leftslipper/a...orms-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,statu s=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/subs...#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/subs.../aa948874.aspx
> ==================================================
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Reorder dictionary in pyrhon according to a list of values!!! imperialguy Python 0 05-08-2011 05:15 AM
reorder list JohnE ASP .Net 2 02-06-2010 07:16 PM
Window.Open get new tab instead of new window in FireFox Fredzidd@gmail.com Javascript 1 02-29-2008 03:06 AM
window.open() doesn't open new Window in Opera PC HUA Javascript 2 05-19-2004 02:29 AM
Need to open a new browser window, not a new window Gordon ASP General 3 04-16-2004 10:46 PM



Advertisments