Jaa


Dynamic content made easy [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!

DynamicPopulateModalPopup.gif

Comments

  • Anonymous
    September 19, 2006
    David has a great post on using DynamicPopulate. 
    Check it out!

  • Anonymous
    September 27, 2006
    Hi Delay,

    Is it possible to use the ModalPopupExtender control to display the EditZone or Catalog of a webpart page.

    I am currently implementing webparts on a page which is already quite crowded. So It would be nice that I could display editparts in a popup.

    The problem is that because webparts and editparts are dynamidcally generated. I don't know how to set the "TargetControlID", "OKControlID" and "CancelControlID" and so other properties.

    Thanks

    Byron

  • Anonymous
    September 28, 2006
    Byron,

    In general, the approach people tend to take for scenarios like this one is to use "placeholder" controls for TargetControlID/OkControlID/CancelControlID, hook the ModalPopup up to the placeholder controls so it has something to hook up to, hide the placeholder controls with style "display:none" so they're not visible, and redirect input to the placeholder controls from the "real" input controls by adding some JavaScript and calling the onclick() methods of the placeholders. I know of a number of situations where this has proved helpful, but also a few where it's not feasible. If you're still stuck, please use the blog's contact link [http://blogs.msdn.com/delay/contact.aspx] to get in touch with me directly or post a new thread on the Toolkit's ASP.NET support forum [http://forums.asp.net/1022/ShowForum.aspx].

    Thank you!

  • Anonymous
    September 30, 2006
    Cool and easy to understand "How To". Thanks!
    You should really link to this kind of examples from the main site of Atlas and the Toolkit

  • Anonymous
    October 02, 2006
    I notice your example doesn't work when I run it in a page on the WebDevServer, seems to work fine if I put it in IIS. Also I notice the Custom Script property for the dynamic control is not supported in the new additions.  I don't need the overhead of a round trip, I can figure out what to display by running a simple client script.  Any chance you are going to add that to the dynamic support for the popups? Matthew

  • Anonymous
    October 19, 2006
    Delay,   Your post has been very illuminating when it comes to the seeming difficult taks of dynamic population.  I am now well on my way to getting good, dynamic content from both code behind and webservices.  However, this content is limited to text.  I am in need of returning a whole content panel from my code behind.  Is this possible?  And if so, any thoughts on how to proceed? Thank you so much for your blog, Tom

  • Anonymous
    October 19, 2006
    Matthew: This sample should work fine with the ASP.NET Development web server - I developed it that way and know of others who have run it successfully like that. I'm not sure why it wouldn't work for you without knowing more about the specific error. Feel free to contact me directly (http://blogs.msdn.com/delay/contact.aspx) if you want to troubleshoot this in more detail. Tom: Thanks for the kind words! The content that's returned can include HTML tags, so you can enhance the output a little bit that way. Regarding sending back more complex content (like the ASP.NET controls you're asking about), the thinking is that it should be possible to render the control on the server in the dynamic populate method and then return the resulting HTML representation to the browser. I'd like to look into this more and maybe blog an example sometime soon, though I haven't yet had the time to do so. Hope this helps!

  • Anonymous
    November 07, 2006
    Since the feature request has come up so many times here and since we now support the relevant scenario

  • Anonymous
    November 13, 2006
    hi, i tried to use the modalpopup as detail viewer of a gridview. i used something like: <asp:linkbutton id="lnk" runat="server">Details</asp:linkbutton> <tool:ModalPopupExtender ID="popupInfo" runat="server" PopupControlID="pnlDetails" TargetControlID="lnk" DropShadow="true" OkControlID="btnOk" BackgroundCssClass="background"/> into a <ItemTemplate> of a <asp:TemplateField> I tried to put some code (in order to populate the pnlDetails) into grid.RowCommand handler routine but that event hasn't been raised. thanks

  • Anonymous
    November 13, 2006
    Kralizek, Please use the contact link (http://blogs.msdn.com/delay/contact.aspx) to email me directly with a small, self-contained sample demonstrating the problem you're having. I'll have a look to see what might be causing trouble. Alternatively, you can make a post to our ASP.NET support forum (http://forums.asp.net/1022/ShowForum.aspx) and I or someone else there will help out. Thank you!

  • Anonymous
    November 17, 2006
    I previously blogged a sample demonstrating how to use the AJAX Control Toolkit's dynamic population

  • Anonymous
    December 22, 2006
    I have a GridView that is placed within an UpdatePanel. Within the GridView I have an ItemTemplate containing

  • Anonymous
    January 15, 2007
    Hi Delay, your example is very clear and useful, thanks a lot. I tried your code sample and I got a "Service call failed: 12030" message instead of the time-stamp inside the popup (the rest of the message was ok). I 'translated' your atlas-sample into ajax-enabled code but I think this is not the issue. Did anything similar happen to you? Have you got any idea on how can it happen? I could not find anything on it in the web. Thanks, Pawel

  • Anonymous
    January 15, 2007
    Pawel, Getting error 12030 from an ASP.NET AJAX web service call typically indicates a problem with the service path or method name that was used to access the web service. You can see this by changing the path/name used by any of the working examples. In your case, it seems pretty likely that the path being used by your translated code is somehow incorrect. You might try comparing the network traffic of my original sample that works against your current code that's not working to see where the problem might be. Firebug makes examining web service calls pretty easy, so you might try that first. Thanks and good luck!

  • Anonymous
    January 16, 2007
    Hi Delay... I'm trying to use the PopupControlExtender on dynamically created textboxes and I'm having a little trouble coming up with the proper implementation.  Since the PopupControlExtender derives from the same base class as the ModalPopupExtender I'm hoping that there related enough that I'm not totally off topic.   I'm basically creating a bunch of textboxes dynamically and likewise I'm dynamically creating a bunch of popupcontrolextenders to go along with them which ties them to a listbox.  All I want to do is populate the proper textbox when the value is selected in the listbox.  Since I'm dynamically creating these controls, I'm a bit confused as how to actually do this.   If I use the listbox's eventhandler, I have no way of determining which extender to commit since the sender parameter of the listbox eventhandler naturally has only the listbox and the eventargs are blank.   Looking at your example, I can use the DynamicContextKey in the PopupControlExtender to help me out by calling a web method which will use the DynamicContextKey to encode the id of the textbox as part of the values of the listbox and upon postback, i can parse out the id in the listbox's eventhandler, find the proper extender and the commit the proper extender but I don't want the overhead a web service call everytime someone clicks on a textbox.   I guess I have two questions, is there a clean way that I can do what I'm trying to do... And is there anyway to use a javascript function instead of a web method?  Thanks in advance for your help and sorry again if it's a little off topic.  After all my searching, you seem like the most qualified person to answer this question.  

  • Anonymous
    January 17, 2007
    Yabadabadoo, If I understand your scenario correctly, you don't need to use dynamic population at all. Please have a look at the ToolkitTestsManualRepeater.aspx page that comes with the Toolkit for an example of using the same PopupControlID with multiple TextBoxes. The TextBoxes aren't created dynamically in this case, but I think the example's still relevant for you. Contact me directly if you're still having troubles after playing around with this sample for a while. Thanks!

  • Anonymous
    January 17, 2007
    Hi, thanks for your exposition. I found all the  CSS and databinding stuff a bit confusing as I was just looking for the essential functionality( a bear of little brain , I'm afraid). I have tried using it but keep getting "Web Service call failed:500" I am trying to load a panel (Panel2) with custom HTML depending on the contents of a textbox(an integer). The same thing happens if I just use  DynamicContextKey='10' so its not the eval. my tag code is: <cc1:ModalPopupExtender            ID="ModalPopupExtender1"            runat="server"            TargetControlID="LinkButton1"            PopupControlID="Panel1"                        OkControlID="OkButton"                        CancelControlID="CancelButton"            DynamicControlID="Panel2"            DynamicContextKey='<%# Eval("TextBox1.Text") %>'            DynamicServiceMethod="loadFilter"            ></cc1:ModalPopupExtender> In the codefile I have: [System.Web.Services.WebMethod] public string loadFilter(string contextKey) { int intObjID = int.Parse(contextKey); ....other code...... return FilterHandler.getFilterHTML(); } Do you know why this is happening? Thanks.

  • Anonymous
    January 17, 2007
    davaus, Getting error 500 from a web service call usually means that the path to the web service is correct, but something about the method being called is not quite configured properly. Please have a look at the following blog post in which I discuss what it takes to update to one of the recent ASP.NET AJAX builds from an earlier build. Specifically, I suspect you need to make loadFilter static and decorate it with the ScriptMethod attribute as outlined in step 5 of that post. http://blogs.msdn.com/delay/archive/2006/11/17/dynamic-content-made-easy-redux-how-to-use-the-new-dynamic-population-support-for-toolkit-controls.aspx Hope this helps!

  • Anonymous
    January 17, 2007
    Thanks for the help Delay. I found I had to use [System.Web.Script.Services.ScriptMethod],not [Microsoft.Web.Script.Services.ScriptMethod]. The method is now being called properly. Is it possible to get a reference to the ModalPopupExtender control in javascript, so that I can set the DynamicContextKey attribute in script? This seems to be a non-obvious thing to do. I need to generate different internal HTML depending on what object on my page is being clicked. Thanks again for your prompt help David  

  • Anonymous
    January 17, 2007
    Okay, I just found out how to use $find to get a reference. var popext = $find("ModalPopupExtender1");    var objid = document.all.item('TextBox1').value; Okay so far...    popext.DynamicContextKey=objid; This doesn't seem to work however. The string contextKey parameter still comes through as null. Any Ideas? I'm pushing an assumed friendship here :D

  • Anonymous
    January 20, 2007
    davaus, You're very close - try "popext.set_DynamicContextKey(objid);" instead. That will call the DynamicContextKey property setter on the ModalPopupBehavior instance you've got and should be just what you're looking for!

  • Anonymous
    January 27, 2007
    Hello, really fine stuff to be enabled to switch the content dynamically. My problem very similar to the issues mentioned above. I Always receive errors like "Web Service call failed: 12030" and sometimes its just number 500.. I try to change the attribute above the serverside method GetContent(..), i also tried to mark it as static but without result. Does anybody have more ideas about a solution to the trouble? Also another question: Do you use IIS 7.0 or 6.0 or the small developer webserver built into Visual Studio? Could the problem depend on the configuration of the webserver or the configuration file? Kind regards

  • Anonymous
    January 27, 2007
    ltrader, As you note, I discuss common causes of web service errors 500 and 12030 in earlier replies to this blog post. When troubleshooting issues like yours, I recommend you start from a working sample (either one of the ones from this web site or the ToolkitTestsManualDataboundDynamicPopulate.aspx version that comes with the Toolkit itself). Examining the relevant network traffic can also be very helpful and tools like Fiddler and Firebug make it relatively easy to do. On the Toolkit team we use a mixture of IIS 6, IIS 7, and the Visual Studio Development Web Server to develop and test the Toolkit, so all of these servers are known to work well with the Toolkit. Mis-configuration of the server/site could definitely lead to problems - that's one of the other reasons it can be helpful to start from a working sample since you can be pretty sure that the Toolkit's web sites have a correctly configured web.config file and run fine under the VS Web Development Server. Good luck!

  • Anonymous
    January 28, 2007
    Hello Delay, thanks for the quick reply. I will try to figure out working samples and compare these to mine. Hopefully I will find the differences causing the trouble.

  • Anonymous
    January 28, 2007
    Hello again, a couple of hours I tried to get a few samples using the Methods DynamicServicePath, DynamicControlID,                 DynamicServiceMethod,                DynamicContextKey, to run. No chance at all. I also tried the above sample just like mentioned above. I do not know which kind of fault is the reason for the "Web Service call failed: 12030". Is there another code snipped necessary which is not showed right here on the page? I tried just simply to return a hard coded string. At the bottom the code I use is listed. Perhaps anybody of you can see the mistake and it is just not obvious to me!? <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <script runat="server">    // Using bot attributes, I also tried each of the both attributes single. No success at all!?  [System.Web.Services.WebMethod]  [System.Web.Script.Services.ScriptMethod]  public string GetContent(string contextKey)  {      return "test";  } </script> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server">    <link href="StyleSheet.css" rel="stylesheet" type="text/css" />    <title>Untitled Page</title> </head> <body>    <form id="form1" runat="server">        <asp:ScriptManager ID="ScriptManager1" runat="server" />        <div>            <asp:Panel ID="ModalPopupPanel" runat="server" CssClass="modalPopup" style="border: 1px solid red;display:none" >                <div runat="server" id="divModalPopupContent">divModalPopupContent</div>                   <p>This popup popped at <asp:Label ID="lblDynamcControl" ForeColor="red" runat="server" /> and all was well.</p>                <asp:Button ID="btnOK" runat="server" Text="btnOK" />                <asp:Button ID="btnCancel" runat="server" Text="btnCancel" />            </asp:Panel>            <asp:LinkButton ID="lbOpener_01" runat="server" Text="lbOpener_01" />            <cc1:ModalPopupExtender ID="ModalPopupExtender1" runat="server"                TargetControlID="lbOpener_01"                Drag="true"                BackgroundCssClass="modalBackground"                DropShadow="true"                OkControlID="btnOK"                CancelControlID="btnCancel"                PopupControlID="ModalPopupPanel"                DynamicControlID="lblDynamcControl"                                DynamicServiceMethod="another test"                DynamicContextKey="GetContent"                />        </div>    </form> </body> </html>

  • Anonymous
    January 29, 2007
    ltrader, As noted by comments above, your GetContent method needs to be marked "static" in recent releases of ASP.NET AJAX. Also, you seem to have gotten DynamicServiceMethod and DynamicContextKey mixed up - DynamicServiceMethod should be set to "GetContent" (rather than "another test"). Making those two changes to the sample you provided gets it working for me. Thanks!

  • Anonymous
    January 30, 2007
    First, let me say that I have never worked with web services before. I tried using your code sample, and continue to get the 12030 error. One of your posts talks about web.config being configured correctly. WHat needs to be in web.config for the services to function correctly? Also, what is the DynamicSerivcePath attribute acutally specifying (in other words, what, exactly, is the value for the path).  I also tried adding a web service item to my project, and entered a public method for the dynamic service. Nothing seems to work. In debugging, I was able to ascertain that the code isn't even being executed--I gotta' believe this has to do with the DynamicServicePath, but I have no idea how it is supposed to be configured. thanks, kevin

  • Anonymous
    January 30, 2007
    EONTECH, The code associated with this particular blog post is based on a pre-release version of ASP.NET AJAX. Please try running the implementation that comes with the Toolkit as the file ToolkitTestsManualDataboundDynamicPopulate.aspx. That version runs fine as-is with ASP.NET AJAX 1.0 and the latest Toolkit release, 10123. The Dynamic* properties are similar to those documented on the DynamicPopulate sample page included with the Toolkit and available at http://ajax.asp.net/ajaxtoolkit/DynamicPopulate/DynamicPopulate.aspx. In particular, DynamicServicePath specifies the path to the web service that should be used to call the DynamicServiceMethod (passing in the DynamicContextKey) - the results of which are stored in the innerHTML of the DynamicControlID. Once you grok how this all works and have a running sample to play with, it's really quite easy to use! Good luck!

  • Anonymous
    February 02, 2007
    var popext = $find("ModalPopupExtender1");   var objid = document.all.item('TextBox1').value; popext.set_DynamicContextKey(objid); Where does this code get called from?  I am wanting to use the value of a textbox as the contextkey, but can't seem to figure it out....

  • Anonymous
    February 02, 2007
    cognitronic, I assume you're referring to an earlier post by davaus. I assume the code in question is running in a client-side event handler for an input element, perhaps a button. You could probably also push a TextBox's content into the ContextKey by attaching to the onchange client-side event of the TextBox. Use whatever works best in your situation! :)

  • Anonymous
    February 08, 2007
    This relates to the question that davaus had. I have defined a web service in a separate class, and I am setting the following parameters in a HoverMenuExtender:            DynamicServicePath="GetClientName.asmx" DynamicServiceMethod="GetClientNameByID" I've also made the method in the service static and decorated it with [System.Web.Script.Services.ScriptMethod], but I am still getting the 'Web Service call failed' error.  Everything works fine when the service is defined within the same page, so I'm guessing that I must be missing something. Are you able to shed any light on what it is that I've overlooked? Thanks in advance.

  • Anonymous
    February 09, 2007
    Darth, If you've already got things working on the same page, that's a great way to know that your method itself is doing the right thing. When you move the method out of the page and into a web service, there are a couple of things you need to change for ASP.NET AJAX to do the right thing - see http://ajax.asp.net/docs/tutorials/ConsumingWebServicesWithAJAXTutorial.aspx for more details. In your case, I suspect that the only thing you'll need to do is change to [System.Web.Services.WebMethod] on the GetClientNameByID method itself and add [System.Web.Script.Services.ScriptService] to the WebService-based class that it's in. The documentation covers some other things to verify, too, but I'm thinking you'll need only these two changes. Good luck!

  • Anonymous
    February 22, 2007
    I've been searching for some content I finally found on a blog here, but need a litlte more help. I am

  • Anonymous
    May 15, 2007
    What if you want to have each button in a gridview fire the ModalPopup?  The buttons all say "Delete" and I want to pop up the same verification dialog for each button when clicked. Is this possible? (Other than making it a Submit button by specifying CausesValidation="true" and then creating a separate ModalPopup structure for each generated NAME tag, that is.)

  • Anonymous
    May 15, 2007
    SOwens, I think you're asking about sharing a single ModalPopup instance across multiple items in a Repeater-like control. If so, then the below sample code should demonstrate how to do that. It involves simply forwarding the click events from the bound buttons on to a placeholder button that the shared ModalPopup uses. See the OnClientClick property for how this is done. The rest of the code is just scaffolding to set the demonstration up! :) <%@ Page Language="C#" %> <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server">    <title>ModalPopup Sharing Demonstration</title>    <style type="text/css">        .background { background-color:Gray; }    </style> </head> <body>    <form id="form1" runat="server">        <asp:ScriptManager ID="ScriptManager1" runat="server" />        <!-- GridView to display the data -->        <asp:GridView ID="GridView1" runat="server" DataSourceID="XmlDataSource1">            <Columns>                <asp:TemplateField>                    <HeaderTemplate>                        Button                    </HeaderTemplate>                    <ItemTemplate>                        <!-- Bound button invokes the shared ModalPopup when clicked -->                        <asp:Button ID="Button3" runat="server" Text='<%# "Modal " + Eval("Text") %>'                            OnClientClick="$get('Button1').click(); return false;" />                    </ItemTemplate>                </asp:TemplateField>            </Columns>        </asp:GridView>        <!-- Shared ModalPopup and placeholder button TargetControlID (unused) -->        <asp:Button ID="Button1" runat="server" Text="Placeholder" style="display:none;" />        <ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="Button1"            PopupControlID="Panel1" OkControlID="Button2" BackgroundCssClass="background" />        <!-- Simple Panel content for ModalPopup -->        <asp:Panel ID="Panel1" runat="server" style="background-color:White; border:solid; padding:20px; display:none;">            <asp:Button ID="Button2" runat="server" Text="Dismiss Popup" />        </asp:Panel>        <!-- Simple data set -->        <asp:XmlDataSource ID="XmlDataSource1" runat="server">            <Data>                <Root>                    <Item Number="1" Text="One" />                    <Item Number="2" Text="Two" />                </Root>            </Data>        </asp:XmlDataSource>    </form> </body> </html>

  • Anonymous
    July 09, 2007
    Hi Delay! Please fix this error for me: <%@ Control Language="C#" ClassName="LeftControl1" CodeFile="LeftControl1.ascx.cs" Inherits="LeftControl1"%> <%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"    Namespace="System.Web.UI" TagPrefix="asp" %> <script runat="server">  [System.Web.Services.WebMethod]  public void GetCities(int contextKey)  {      DealRoom_Countries_CitiesDataComponent.DealRoom_CitiesDataTable dtCity = DealRoom.BusinessLogicLayer.DealRoom_CitiesDB.DealRoom_GetCitiesByCountryId(contextKey);      CityGrid.DataSource = dtCity;      CityGrid.DataBind();  } </script> <div> <table border="0" cellpadding="0" cellspacing="0" width="219px">    <tr>       <td class="LeftTitle2" id="lbl1" align="center" style="width:100%">            INTERNATIONAL       </td>    </tr>    <tr>        <td>            <table border="0" cellpadding="0" cellspacing="0" width="219px" class="LeftMetro2">                <tr>                    <td style="width:30%; height: 99px;" >&nbsp;</td>                    <td style="width:70%; height: 99px;">                        <asp:ScriptManager ID="ScriptManager1" runat="server" />                           <%-- This Panel is for the contentInner panel --%>                           <asp:Panel ID="Panel2" runat="server" HorizontalAlign="Left" ScrollBars="Auto" CssClass="contentInner">                           <%-- The Grid that holds the data --%>                           <asp:GridView SkinId="DefaultGrid" ID="HoverGrid" DataKeyNames="ID" runat="server" AutoGenerateColumns="False" BorderWidth="0px" CellPadding="2" GridLines="None" ShowHeader="False">                             <Columns>                               <asp:TemplateField>                                 <HeaderTemplate />                                 <ItemTemplate>                                   <%--  Action Menu Template  --%>                                   <asp:Panel Width="120px" CssClass="popupMenu" ID="PopupMenu" runat="server">                                     <div style="border: 1px outset white; vertical-align: middle;">                                        <asp:GridView ID="CityGrid" runat="server" AutoGenerateColumns="False" BorderWidth="0" CellPadding="0" GridLines="None" ShowHeader="False">                                            <FooterStyle BackColor="White" ForeColor="#000066"/>                                            <Columns>                                                <asp:TemplateField>                                                    <ItemTemplate>                                                            <asp:LinkButton runat="server" ID="lnkCity" Text='<%# Bind("CityName") %>' CausesValidation="false" ForeColor="#000000"                                                                CommandArgument='<%# Eval("ID") %>' CommandName="Select" ></asp:LinkButton>                                                                                                </ItemTemplate>                                                    <ItemStyle HorizontalAlign="Left" VerticalAlign="Middle" />                                                </asp:TemplateField>                                            </Columns>                                        </asp:GridView>                                                                           </div>                                   </asp:Panel>                                   <%--Data Row Template  --%>                                   <asp:Panel ID="GridRows" runat="server">                                     <table width="100%" style="text-align: left;">                                       <tr>                                         <td style="width: 219px;">                                           <asp:Label ID="Country_Name" runat="server" Text='<%# HttpUtility.HtmlEncode(Convert.ToString(Eval("CountryName"))) %>'/></td>                                       </tr>                                     </table>                                   </asp:Panel>                                   <%--Hover Menu Extender --%>                                   <ajaxToolkit:HoverMenuExtender ID="HoverMenuExtender" runat="Server"                                      HoverCssClass="popupHover"                                      PopupControlID="PopupMenu"                                      PopupPosition="Right" DynamicContextKey='<%# Eval("ID") %>'                                      DynamicServiceMethod="GetCities"                                        TargetControlID="GridRows" PopDelay="50">                                                                       </ajaxToolkit:HoverMenuExtender>                                 </ItemTemplate>                               </asp:TemplateField>                             </Columns>                           </asp:GridView>                         </asp:Panel>                    </td>                </tr>            </table>        </td>            </tr> </table> </div> error: The name 'CityGrid' does not exist in the current context thanks

  • Anonymous
    July 09, 2007
    khoadd, The code above is trying to use HoverMenu's dynamic population support, but the scenario doesn't seem to be appropriate. The specific error you're getting ("The name 'CityGrid' does not exist in the current context") is because the CityGrid object exists inside an ItemTemplate and is therefore not accessible at page-level as the code's trying to do. If you want to do data binding in this manner, an ASP.NET UpdatePanel is probably more appropriate. For answers to specific implementation questions like this one, our support forum is quite active and is a great place to post: http://forums.asp.net/1022/ShowForum.aspx. There are a lot of people there who are great at answering questions like this one. Thanks!

  • Anonymous
    July 09, 2007
    Hi Delay! Thank you very much

  • Anonymous
    August 17, 2007
    The comment has been removed

  • Anonymous
    August 17, 2007
    Chris W, The text returned by dynamic population is simply assigned to the DynamicControlID's innerHTML property. That doesn't seem to run the embedded script for your scenario, but you should be able to accomplish something similar by attaching some code to the "populated" event that the PopupControl/ModalPopup you're using exposes. This is easy to do with the behavior's add_populated(...) method. For an example of how this works, the ToolkitTestsManualAutoCompleteWithContext.aspx file that comes with the Toolkit attaches to the "populating" and "populated" events in order to run some custom code during dynamic population. It seems like just what you're looking for!

  • Anonymous
    August 19, 2007
    I looked at the test and I believe I understand how it works.  However, my $find always returns null.  I've tried function pageLoad() {  var popup = $find('PopupControlBehavior'); } and function pageLoad() {   var popup = $find('PopupBehavior'); } I know the pageLoad is firing because I added an alert as a debugging thing.  Is there a different behavior I should be looking for?

  • Anonymous
    August 20, 2007
    Chris W, By default, a behavior's ID (the thing you pass to $find) is the same as the ID you specify when creating the extender (ex: <ajaxToolkit:Extender ID="MyID" ... />). But when the behavior is in a naming container (like a master page, repeater, etc.), then the ID that ASP.NET assigns is changed to include the naming container's ID as well (ex: NamingContainer.MyID). You can either View Source in the browser to see what the actual ID ends up being OR you can use the BehaviorID property we've added to our extenders for just this purpose (the example I pointed you to uses BehaviorID, by the way). When BehaviorID is used, then you can $find the behavior with the exact string you specify as the BehaviorID and not have to worry about naming container issues at all. So what I'd suggest is adding BehaviorID="MyID" to your extender and then finding it with $find("MyID"). This should do exactly what you want!

  • Anonymous
    December 15, 2007
    Hi Delay, Your example seems very clear, but just as other users I am getting constantly "Web Service call failed: 12030" and as one offs "Web Service call failed: 500" which on subsequent call again reverts to 12030. Below is the snippet with the path to the web service method. Is it resolved properly at page rendering? "dynamicServiceMethod":"GetContent","dynamicServicePath":"/ProjectName/Pages/WebPage.aspx"

  • Anonymous
    December 17, 2007
    bbzz24, If you haven't already, please review the recommendations I've made to other instances of this question in previous responses. What I'd probably do next in your case is to look at the network traffic to see what's in the response body for the web service call. Fiddler or Firefox+Firebug make this pretty easy and reading through the response details often indicates exactly what the problem is. Hope this helps!

  • Anonymous
    June 05, 2008
    To anyone still using this sample and still getting web service failed errors (either 500 or 12030): (1) Review all the suggestions provided above (path, etc.). (2) make sure your input parameter name is "contextKey" as shown in the example. So a VB version wound be blah(byval contextKey as string) This error threw me into a loop since the above example is so straightforward that this error was mind-numbing. To add insult, if you ran the default function HelloWorld of your webservice, it runs fine. So path errors aren't to blame. I'll defer to the Delay on why using "contextKey" for the parameter name is   required....and if I missed it, where this is documented....   Hope this helps...

  • Anonymous
    June 05, 2008
    EdSF, Thanks a lot for clarifying that! That web service parameters are case-sensitive is due to the ASP.NET AJAX framework on top of which the Toolkit is built. I suspect it's called out explicitly somewhere in their documentation; we try to call it out on the DynamicPopulate page's Properties section and it's hinted at in the Toolkit FAQ: http://forums.asp.net/t/992919.aspx#faq_v3_3_3. But I agree that it's a very subtle thing and tricky to track down the first time you bump into it! So thank you for taking the time to bring attention to this requirement!

  • Anonymous
    June 05, 2008
    Hi Delay, Aha! That's where it was :) THANK YOU for YOUR time with providing excellent samples! My problem wasn't even case-sensitivity, I was using some other parameter name in the web service function...HelloWorld works since it doesn't make use of any params... That link is invaluable - thanks for that too! Ed