Freigeben über


Dynamic content made easy *redux* [How to: Use the new dynamic population support for Toolkit controls]

**

This blog has moved to a new location and comments have been disabled.

All old posts, new posts, and comments can be found on The blog of dlaa.me.

See you there!

Comments

  • Anonymous
    November 20, 2006
    I tried the above and it works great if you are on a single aspx page. However, If I nest the code into a Web User Control and drop onto a web page that uses a Master Web Page the Web Method is never executed. Any suggestions on how to make this scenario work? Are there scripts I need to move/update for this scenario? I am using other AJAX Controls on this page like the CollapsiblePanelExtender, UpdateProgress and UpdatePanels and they are working fine, its just the WebMethod is never called from the ModalPopupExtender.

  • Anonymous
    November 20, 2006
    leomrozek, The problem seems to come about when you insert the sample code into a WebUserControl. When the attempt is made to call the GetContent method to populate the dynamic content, the call is made relative to the page hosting the WebUserControl. However, the GetContent method isn't defined there, and the relevant logic to connect the caller to the method doesn't seem to be done by ASP.NET AJAX. To address this issue, you can simply move the GetContent implementation out to the page hosting the WebUserControl. Alternatively, make it a WebService and then you can host it and call it from anywhere you want!

  • Anonymous
    November 30, 2006
    I previously blogged an update to my sample demonstrating how to use the AJAX Control Toolkit's dynamic

  • Anonymous
    December 16, 2006
    How about if I want DataGrid or DataView inside Panel1 which value depends on DynamicContextKey?

  • Anonymous
    December 18, 2006
    Steward5732, Something like what ScottGu blogged about in the following post should work for you: http://weblogs.asp.net/scottgu/archive/2006/10/22/Tip_2F00_Trick_3A00_-Cool-UI-Templating-Technique-to-use-with-ASP.NET-AJAX-for-non_2D00_UpdatePanel-scenarios.aspx We're hoping to incorporate a method of rendering ASP.NET controls for dynamic content into the Toolkit in a future release in order to make this easy for everyone. For now, ScottGu's blog has helped a number of people out, so please give it a try!

  • Anonymous
    January 25, 2007
    Hi all, I have installed ASP.NET AJAX 1.0 (the 01/23/2007 release) I have a usercontrol with a Panel

  • Anonymous
    January 29, 2007
    The comment has been removed

  • Anonymous
    January 29, 2007
    jf25, I've seen IE give errors like this when attempting to write to the innerHTML property of an INPUT element. Maybe check that the DynamicControlID is pointing to something like an asp:Label instead of an asp:TextBox?

  • Anonymous
    February 23, 2007
    The comment has been removed

  • Anonymous
    February 23, 2007
    ric_castagna, The <%=/<%# syntax you're using in your example is evaluated on the server at page render time when creating the HTML for the web page. It sounds like you're trying to use that syntax to set DynamicContextKey on the client to whatever value is chosen in a DropDownList control that doesn't postback. If so, I don't think that'll work since the server doesn't get involved and has no opportunity to render out the desired value.

  • Anonymous
    February 23, 2007
    Delay, That makes a lot of sense, actually...so, have you found a way to make that DynamicContextKey something that can be set from a client-side function or in response to the OnSelectedIndexChanged event of the dropdown(s) that are already being 'watched' by an update panel? I'd hate to have to scrap this entire idea, but populating the information and tracking the value is necessary if I'm going to be able to use this for modify/delete operations. I appreciate the help! Ric

  • Anonymous
    February 23, 2007
    ric_castagna, ModalPopupBehavior exposes a set_DynamicContextKey method (defined by DynamicPopulateBehaviorBase in BaseScripts.js) that you can use for this purpose. However, because the populate method in DynamicPopulateBehaviorBase caches the DynamicPopulateBehavior instance it creates, that technique will only affect the first invocation of ModalPopup. If that's not a problem for your scenario, great! But if you need to change the value subsequently, you could examine the _dynamicPopulateBehavior member of your ModalPopupBehavior instance to verify the internal DynamicPopulateBehavior has been created and then call set_ContextKey on that instance to update the value it uses. This technique should work fine, though please note that _dynamicPopulateBehavior is officially "private", so this method could possibly break in a future release (though I doubt it will).

  • Anonymous
    February 26, 2007
    OK, I must be too dumb to understand how to implement the set_DynamicContextKey method you've talked about. Where can I wire this up? I've tried attaching it to the "OnClientClick" property of the linkbutton that is supposed to fire my modalpopup, but it just hangs the browser. Odd discovery, when I put simple javascript such as alert("Hello") into that OnClientClick property it works just as expected...it's only when I try to call a javascript function that the browser hangs. I know that Davaus was trying to do this on another thread of your blog, but unfortunately for me, he didn't show how to call the javascript function either. I really appreciate and need some help on this one! Ric

  • Anonymous
    February 26, 2007
    The comment has been removed

  • Anonymous
    February 27, 2007
    Dude...you rock! Works like a champ. I never would've thought to chain javascript into the OnClientClick event...I kept looking for a way to call a single function and, as we saw, that wasn't doing me a bit of good. Thanks for the help! Ric

  • Anonymous
    March 19, 2007
    hi I would like to dynamically populate a datalist on a panel that will be popped up by my HoverExtender.

  • Anonymous
    March 29, 2007
    Is it possible to use the ModalPopupExtender to simply display a wait panel with no OK/Cancel button on it while a web service call is being made and then remove panel (modal popup) once the web server returns the results (and display the results on the page)?

  • Anonymous
    March 29, 2007
    Mehdi_LA, Yes, this should be pretty easy! All you need to do in JavaScript on the client side is to find the ModalPopupBehavior (use $find and specify the value of the ModalPopupExtender's BehaviorID property), call the behavior's .show() method before calling your web service to display the popup, and then call the .hide() method after the web service completes (successfully or unsuccessfully). It's that easy! :)

  • Anonymous
    April 08, 2007
    The comment has been removed

  • Anonymous
    May 11, 2007
    Hello, thanks for your nice code. Everything works fine. When I upload this on my server and set in my web.config sessionState to cookieless="true" I get this error message: Web Service call failed: 500 What can I do now? Is there any solutions for this? Thanks for any help! Joerg

  • Anonymous
    May 13, 2007
    The comment has been removed

  • Anonymous
    May 14, 2007
    The comment has been removed

  • Anonymous
    May 14, 2007
    The comment has been removed