Showing posts with label custom. Show all posts
Showing posts with label custom. Show all posts

Saturday, March 24, 2012

Wrapping a custom control for AJAX

I have a custom control the renders a list/grid based on a specialized datasource. All of the heavy lifting is done in OnRender, where I use the HtmlTextWriter to output raw html. I do this because the nature of the containing pages dictates that I render as late and as efficiently as possible. I have implemented this control in a large number of areas across several applications.

Now I am interested in upgrading those applications to use the ASP.NET AJAX framework. The problem is, none of my custom list controls behaves properly inside an UpdatePanel. I believe this is because the controls are rendered late and rendered as straight HTML.

My question is: What are my options on getting this control to behave itself? Obviously the "re-write the control" route is my last option (not because of the time to rewrite, but because of the time to regression test hundreds of implementations of the control). Is there an elegant way to wrap or subtly modify the control such that containers won't necessarily know that it has changed, and still have it perform client-side post backs and in-place updates? I'm open to all suggestions. I'm not a neophyte on this stuff; I've been using the XMLHttpRequest object to do in-place updates for years. But this one has me a little stymied on the practicality of a solution.

I appreciate any help.

Thanks,

Jason

My only solution for you is using the XMLHttpRequest object to do updates:(

I'll think about it tomorrow,Maybe I can provide you with a better solution.

Thanks

Wednesday, March 21, 2012

Writing New Control - WebResource Url Throwing Exception

Hey Everyone,

I'm having a really hard time with this one. I recently upgraded to lateest control toolkit, and now i can't use my custom controls. I get the dreaded unrecognized tag error.

When I try to load the webresource.axd url for the javascript, I'm getting the following error:

WebResource.axd?d=_IYF6c389WdEZP8BREten0VCyRTYFXUFn9GR9MRXP-aoOJ5cYUZwsxAz4rdBOPaz6CoHQyUbH48-Kn0gv5WhhCj2yI8nUNAt-hz-wRrJAwI76fBROssmxDJplsNW85vw0&t=632907313964152042

Specified argument was out of the range of valid values.
Parameter name: offset

Description:An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details:System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: offset

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


Stack Trace:

[ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: offset]
System.Web.HttpResponseStream.Write(Byte[] buffer, Int32 offset, Int32 count) +3153595
Microsoft.Web.Services.WebResourceCompressionModule.OnPreRequestHandlerExecute(Object sender, EventArgs e) +1103
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +92
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64


any ideas?For some reason, the Atlas Control Extender template doesn't make the Behavior.js an embedded resource. Change that in the properties pane and rebuild.
yeah, i saw that in the FAQ, and made sure (and double sure) that it was marked as an embedded resource. and it looks like it is, because i am seeing the resource in the source. it's when the browser tries to read the resource that .NET is throwing that funky WebResourceCompressionModule error...
So using a tool like Fiddler, the js file is being sent across?? Hmmm.
I actually saw this yesterday when I was doing some work but (unfortunately) I didn't ever figure it out, mostly because it kind of magically went a way. I think I rebuilt everything clean and it started working.