ラベル expected の投稿を表示しています。 すべての投稿を表示
ラベル expected の投稿を表示しています。 すべての投稿を表示

2012年3月26日月曜日

Response.Redirect cant worked as expected inside UpdatePanel while placed in a ModalDialog

I placed a updatepanel in a modaldialog and placed a button inside the updatepanel. when clicked on the button, something needs to be done and if necessary, the button maybe call Response.Redirect(...) to force moveing to a new URL in the same Modaldialog.

I placed " <base target='_self' " /> inside the " <head> " of the page, and the Redirect can do as expected while the button is placed outside the updatepanel. but If the button is moved inside updatepanel, the 'Redirect(...)' will always open a new window, that's is unexpected.

I tried the client script, such as ' window.location.replace(...)' also, but it acts as above. even if I placed a <input type='button' onclick='window.location.replace(..)' /> inside the updatepanle.

Is this a bug of UpdatePanel? Because the objective can be done without updatepanel.

Could you please help me?

Thank you very much.

did you try Server.Transfer instead of Response.Redirect ??


Thanks!

I had tried Server.Transfer already yesterday. but a exception is popup.

Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common casuses for this error are when the respons is modified by calls to Response.Write(), response, filters, HttpModules, or server trace is enabled. .....


hi i too faced the same problem i over came it bye writing the Response.Redirect("javascript:mypopfunction()");

in response.redirect write that jave script function call write u r window code in java script to pop up this worked finre for me u also try this it will work if not let me know ao that i may further help u ok byee ALL THE BEST

Vissu


Thank you.

I write client function as follow.

<script>
function MoveToURL(newurl)
{
window.location.replace(newurl);
}
</script>

Then respond to button click event on server-side as follow :

Response.Redirect("javascript:MoveToURL('Dialog2.aspx');");

But the problem still exists. Maybe I didnt catch your real idea. Could you please give a example.


hi pass the page name webform2.aspx as a parameter to function in java script

ieeee....

<script>
function MoveToURL(newurl)
{
var reportWin=window.open(newurl,"options",'resizable=yes,scrollbars=yes,width=780,height=650,left=150,top=50,status=yes')


}
</script>

Then respond to button click event on server-side as follow :

string myaspx="Dialog2.aspx'";

Response.Redirect("javascript:MoveToURL('"+myaspx+"')");

hope this helps...

Vissu


it functions as before. a new window is open unexpected.

it seems all the script executed from inside an updatepanel results in the same. despite of :

window.open

window.location

Response.Redirect


i doing the same thing i send but it is working fine for me i don't know why its not working for u any way try u will defnitly get answer for that ALL THE BEST

Vissu


The problem is that you're trying to do something that requires an HTTP response context to work, in a partial postback which does not return in an HTTP response.

Use something like this:

ScriptManager.RegisterStartupScript(this,this.GetType(),"redir","document.location = 'NewPage.aspx'",true);

hi this will work look at it

ScriptManager.RegisterStartupScript(this,this.GetType(),"EmpReports","javascript:ReportPage('" + PName +"')",true);

write this in C# Code

Vissu


this worked as above. the problem still exists.

Please note that the UpdatePanel is in a ModalDialog.

For the normal window, response.redirect can work correctly.

For the ModalDialog, if updatepanel is not used, the redirect can work correctly by adding <base target='_self' /> to <HEAD>. Once updatepanel is used in modaldialog, the redirect opens always a new window.


Without more much better solution, now I just use the following code:

Replace 'Response.Redirect' with a client script to show a new modal dialog from current dialog.

string script = "window.showModalDialog('Dialog2.aspx'); window.close();";
ScriptManager.RegisterStartupScript(this, this.GetType(), "OpenNewDialog", script, true);

this solution will launch too much dialog window. So I still sincerely hope someone can help me solving this problem ina better way.

Thanks.


You can't do Response.Write() while using an AJAX

See for more details..

http://weblogs.asp.net/leftslipper/archive/2007/02/26/sys-webforms-pagerequestmanagerparsererrorexception-what-it-is-and-how-to-avoid-it.aspx


I am using Response.Redirect, not Response.Write, and Response.Redirect can work correctly with an updatepanel inside a normal window. In this case, the new page can be loaded in the same window. Once Used with an updatepanel inside a modal dialog, the new page is loaded always in a newly opened window. The key difference is between normal window and modaldialog.


What you are trying to do is not possible with ModalPopup extender. The ModalPopup usually binds with an Asp Panel renders as Div (Not a Window). So playing with the url Response.Redirect, window.location will always opens a new page.

2012年3月21日水曜日

RoundedCornersExtender and DropDownList Causing Update Panel to Flash

I have run into a problem when I use the RoundedCornersExtender on an updatepanel. Everything functions as expected unless a DropDownList is contained on the container the RoundedCornersExtender is being applied to. If I place a DropDownList on the Div, on any partial post back, the entire page flashes. It still performs only a partial postback, but it appears that the entire page is being re-rendered. In this simple example it is only the update panel, but on my larger page (multiple divs, tables, etc) it seems all objects on the page flash.

Any help would be appreciated.

In Firefox, it seems to work fine, but I seem to be able to reproduce this problem with ease in Internet Explorer 6.

In my sample code, I have a button that does a simple postback and increments the count displayed in the label by 1.

<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<cc1:RoundedCornersExtender ID="RoundedCornersExtender1" runat="server" Radius="6" Color="Blue" TargetControlID="MyContentDiv" />

<div id="MyContentDiv" runat="server" style="background-color: Red">

This is my content inside the div.

<asp:DropDownList ID="DropDownList1" runat="Server" />

</div>

<asp:Label ID="lblCounter" runat="Server">0</asp:Label>

<asp:Button ID="cmdCount" runat="server" OnClick="cmdCount_Click" Text="Count"></asp:Button>

</ContentTemplate>

</asp:UpdatePanel>

protected void cmdCount_Click(object sender, EventArgs e)
{
int tmpVal = 0;
int.TryParse(this.lblCounter.Text,out tmpVal);
tmpVal++;
this.lblCounter.Text = tmpVal.ToString();
}

Feel a little sheepish on this one. I incorrectly assumed that because it was so specific to having drop downs, something really screwy was going on. This was solved with the whole Setting Debug=False Solutions.

Cheers


Ok, now maybe I am going crazy. It seems to be happening again... Has anyone else been able to reproduce this problem?
I am having the same issue, roundedcornersextender or dropshadowextender with rounded corners are both causing the entire screen to flash when a dropdownlist or listbox are on the page. This must be a bug, I am using beta2, removing the rounded corners makes it go away
hey I am also getting same issue...any update on this?

Hi,

I am also having this problemCrying, hope someone from asp.net team or Microsoft ASP.NETAJAX team member will look into this problem seriously.

Kind Regards,

Dev


I'm just going to chime in for a October 2007 update that I am having this problem as well...

RoundedCornersExtender causes this same problem in my app... All that is in my UpdatePanel is a Gridview. Everything works as expected in Firefox 2.0.0.7 but I get the flash/reload with Internet Explorer 6.0.29. After this happens the Gridview is hidden from the screen. If I remove the RoundedCornersExtender, everything works fine.


By the looks of it, this seems to be a common issue. I'm using an updatepanel with the collapsiblepanel and it works great! Now, if I add any type of changing control such as a DropDownList or ListBox, the flashing beginsConfused. I came up with an alternative for the dropdownlist which was a navigational menu; bad idea! I click on the menu and all the other menus become frozen or won't refresh. So canned that idea. At this point I'm ready to trash the whole thing and start from scratch, let the whole thing flash! I hope this can be figured out.

JZee