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

2012年3月28日水曜日

ResizeControlExtender causes panel to have 0px width and 0px height

All,

I am adding a ResizeControlExtender to a panel that already has a DragPanelExtender and am getting some very odd behavior. The window I want to resize is created dynamically and I add the ajax extender programatically as well. I am able to put a resize handle on the popup window but when I mouse over the handle the panel collapses to 0px width and 0px height. I have specified all of the properties as follows:

ResizableControlExtender resizeWindow = new ResizableControlExtender();

resizeWindow.ID = "timePanelResize" + i;
resizeWindow.TargetControlID = "timePanel" + i;
resizeWindow.HandleCssClass = "handleImage";
resizeWindow.ResizableCssClass = "resize";
resizeWindow.MinimumWidth = 200;
resizeWindow.MaximumWidth = 200;
resizeWindow.MinimumHeight = 24;
resizeWindow.MaximumHeight = 600;
resizeWindow.HandleOffsetX = 186;
resizeWindow.HandleOffsetY = 187;
dragWindowPanel.Controls.Add(resizeWindow);

I am using c#, .Net 2.0, AJAX v1.0.61025, IE 7 and Firefox 2.01. on mouse over the following behavior occurs; In IE it flickers and collapses in Firefox it flickers and the height collapses to the min height. Also, the handle is extremely difficult to grab... Also, the mouse must be in exactly the right pixel position (about 1px wide and tall) in order to grab the handle.

Anybody else see behavior like this? If so, is there a solution?

Thanks,

Kevin

There's an old forum thread about this, but the gist is that you add another Panel/DIV wrapper so the two extenders can point at/modify different HTML elements.

Response.Redirect + Ajax ;location.href too do the same

I have to rediraect to the same page by adding a connection string

ie

'Response.Redirect("Aju.aspx?SplashFrom=0")

but i know that Response.Redirect is not Ajax compatible

So i have done the code like bellow

Protected Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

ScriptManager.RegisterStartupScript(UpdatePanel1, Me.GetType(), "redirectMe", "location.href='Aju.aspx?SplashFrom=0';", True)

End Sub

But this code also refreshes the whole page

what can i do to only update the update panel by doing a redirection?

NOTE:Button2 is inside the same update panel so i did not and ant trigger in update panel


Response.Redirect works just fine with Ajax. If you are getting errors when using it, then most likely your web.config is not set up correctly. Response.Write is not compatible with partial-page updates, but that is for totally different reasons.

Now, for what you're trying to do: Even if you use Response.Write, you are going to get a full page refresh because you are navigating to a new page. Any time you load a new page (even if you just change the querystring parameters, you are still loading a new version of the page), you are going to get a full refresh. Only when you are changing the contents of a page, such as the value of controls, can you do partial-page updates.


In that scenario, you probably shouldn't be trying to use a redirect at all (client side or server). If you need to update another UpdatePanel from Button2_Click, you could either make Button2 one of its AsyncPostbackTriggers or you could call UpdatePanel1.Update() in Button2_Click.

If that's not helpful, provide a bit more detail about what you're trying to do.


See you are redirecting to other page, So definately you can get a full refresh page.

If you change any content then it will possible to stop refresh the page


chetan.sarode:

See you are redirecting to other page, So definately you can get a full refresh page.

No, i am redirecting to same page with change in query string


As far as the client (browser) is concerned, that is a new page. It has to reload the page.


gt1329a:

In that scenario, you probably shouldn't be trying to use a redirect at all (client side or server). If you need to update another UpdatePanel from Button2_Click, you could either make Button2 one of its AsyncPostbackTriggers or you could call UpdatePanel1.Update() in Button2_Click.

If that's not helpful, provide a bit more detail about what you're trying to do.

No;my button is inside the one and only one update panel i have.

I am redirecting to the SAME page with change in query string,because i have programed to fetch data from database based on the value in query string .

If i give the value in query string it will become easy to book mark the exact page


Please listen.

Itdoes not matter that you are redirecting to the same page. Any change in the URI will cause the browser to load what it considers to be a different page. It is a new request to the server. It is still a redirect. The page will be reloaded and you will see a visible refresh... no matter what you have in updatepanels... no matter if not a single thing changed on the page. That is how it works.

If I redirect fromhttp://www.mysite.com/mypage.aspx?q=1 tohttp://www.mysite.com/mypage.aspx?q=2, even if I the content does not change and I do nothing with the querystring, it will still cause a refresh.

If you want to use the querystring parameters to allow you to bookmark specific state of the page, that's fine. Just understand that you will have a visible refresh.


To create bookmarkable URLs, use document.hash instead of document.href. This manipulates the anchor of the URL, which you can do without causing a refresh.


could you please show me an example of document.hash

Thanks in advance


I have a similar problem. I cannot Response.Redirect("newpage.aspx") or ScriptManager.RegisterStartupScript(Me.UpdatePanel1, Me.GetType(), "redirectMe", "location.href='newpage.aspx';", True) with a button inside updatepanel. Is there anyway around this?
Please help!

2012年3月26日月曜日

ResponseFilter & Content-Encoding header, cleared by WriteExceptionJsonString

Hi There,

I have a ResponseFilter adding HTTP compression to my .aspx, ashx, and now .asmx requests, similar to http://blog.madskristensen.dk/post/HTTP-compression-in-ASPNET-20.aspx.

I've just starting using it to compress the web services in a project, which has worked great reducing the traffic immensely. To do this, I've added a response filter to the Response object, and set the "Content-Encoding" header to "gzip". Works great for normal pages and "MyService.asmx/js" requests as well.

Normally, when an exception is thrown inside a web service, the exception is serialised, passed along to the client, and handled by the error callback in javascript code. No worries there.

The error handling stopped working after added the compression as a response filter to the .asmx/js requests. It turns out that the method handles the error "WriteExceptionJsonString" found in "System.Web.Script.Services.RestHandler" clears the response headers before it serialises the exception. This isn't too bad in itself, but the response filter is still in place, so the gzip compression is still used, but now the client consuming the request doesn't know it needs decoding and a javascript error then occurs "result has no properties"

line 4860, result = new Sys.Net.WebServiceError(false, result.Message, result.StackTrace, result.ExceptionType);

Is there a way around this, while still allowing the compression? Or is this some kind behavioral bug in the underlying MS AJAX Rest handler? If theSystem.Web.Script.Services.RestHandler clears the headers... and the content... should it also remove any response filters?

I had a brain wave shortly after posting the previous message.

The HTTP Module I am using did all the Response.Filter setup in the PreRequestHandlerExecute event. That included the Response.AppendHeader("Content-Encoding", "gzip"). The header was subsequently cleared by the System.Web.Script.Services.RestHandler.WriteExceptionJsonString method, but the filter still compress the output stream.

So instead, I moved the Response.AppendHeader("Content-Encoding", "gzip") into the PreSendRequestHeaders event. Now the header gets set correctly for the Response.Filter GZipStream just before the headers are sent.

Hope that helps someone else.

2012年3月21日水曜日

roundedcorners postback flicker

Hey guys.

I have a formview within a panel. Everything works great and when adding a post the screen wont flicker and the post is viewable in the panel immediately.

I recently tried to apply an ajax roundedcorners tool on the panel and it works but the screen flickers at every postback. Is there a way around this?

Could you post some sample code that reproduces the issue? I tried it out but perhaps I am missing something.

<asp:ScriptManagerrunat="server"></asp:ScriptManager><asp:PanelID="Panel1"runat="server"Width="330px"BackColor="Blue"><asp:FormViewrunat="server"ID="EmployeeFormView"AllowPaging="True"DataSourceID="ObjectDataSource1"></asp:FormView><asp:ObjectDataSourceID="ObjectDataSource1"runat="server"DeleteMethod="Delete"InsertMethod="Insert"OldValuesParameterFormatString="original_{0}"SelectMethod="Select"TypeName="SessionTodoXmlDataObject"UpdateMethod="Update"><DeleteParameters><asp:ParameterName="Original_ItemID"Type="Int32"/></DeleteParameters><UpdateParameters><asp:ParameterName="Title"Type="String"/><asp:ParameterName="Description"Type="String"/><asp:ParameterName="Priority"Type="Int32"/><asp:ParameterName="Original_ItemID"Type="Int32"/></UpdateParameters><InsertParameters><asp:ParameterName="Title"Type="String"/><asp:ParameterName="Description"Type="String"/><asp:ParameterName="Priority"Type="Int32"/></InsertParameters></asp:ObjectDataSource></asp:Panel><cc1:RoundedCornersExtenderID="RoundedCornersExtender1"runat="server"BehaviorID="RoundedCornersBehavior1"TargetControlID="Panel1"Radius="10"Corners="All"/><asp:Buttonrunat="Server"Text="Postback"/>