开发者

AJAX Partial page update problem when displaying a control

开发者 https://www.devze.com 2022-12-22 09:22 出处:网络
I have an interesting problem when using partial page update in asp.net with scriptmanager and a update panel.

I have an interesting problem when using partial page update in asp.net with scriptmanager and a update panel.

My scenario looks like this: I'm using the tab control from the ajax toolkit. I also implemented this control using lazy loading, so that when the page is loaded only the current tab gets loaded all the other tabs don't get rendered, because Im using an UpdatePanel (on a .ascx control) on each of these tabs and when a tab gets selected the updatepanel makes a async postback to load the content for a selected tab.

On one of my tabs Im using a combobox control from obout.com, and it doesn't work. Now I know why it doesn't work. It doesn't work because the control is shown via a partial page refresh, but to correctly display the control it has to do some "magic" that is - registe开发者_开发百科r some .css and .js includes on the page (in the head I guess)....but because I load this control via async page refresh...it can't do these stuff.

What kind of workarround do you suggest? Thanks!


Assuming you have done partial ajax updates in asp.net before, then you simply need to register a client block with the ScriptManager for when the partial update is triggered.

Without knowing your problem space, it's difficult to paste specific code for you, so instead I'll just suggest you read this and then ask more questions if you have them...

http://msdn.microsoft.com/en-us/library/system.web.ui.scriptmanager.registerclientscriptblock.aspx

BTW, if you're dynamically creating the controls as well as partially updating them, then you will also need to be very careful of your viewstate. This is a can of worms, so hopefully you are not and won't have to worry about it.


As I suspected you have to manually register the needed scripts for ajax controls to work in such a manner. For example here is the solution for telerik controls: http://www.telerik.com/help/aspnet-ajax/troubleshooting.html

Here is a solution using devexpress controls: protected void Page_Load(object sender, EventArgs e) { DevExpress.Web.ASPxClasses.ASPxWebControl.RegisterBaseScript(this); }

I didn't found a solution for obout.com controls.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号