Error on Grid with Ajax Extender in CellTemplate

1 reply. Last post: January 22, 2010 4:07 AM by Andi Santoso
Tags :
  • New Discussion
  • New Question
  • New Product Feedback

Hi,

This issue actually follows up on another issue that i reported on this thread. What I'm trying to do is add a hyperlink and an ajax modal extender (or any other extender for that matter) within a cell template. First page renders just fine, but when going to some other page in the grid I get:

Extender control 'owhCompanyName_Child_ModalPopupExtender' is not a registered extender control. Extender controls must be registered using RegisterExtenderControl() before calling RegisterScriptDescriptors().
Parameter name: extenderControl

If we follow up on the solution given on this other thread... I can replicate this by modifying the celltemplate to look like this:

public class cellTemplate : ITemplate
    {
        Label labelTemplate;
        public void InstantiateIn(Control container)
        {
            HyperLink hyperlink = new HyperLink() { ID = "hyperlink" };
            LinkButton linkButton = new LinkButton() { ID = "LinkButton", Visible = false };
            Panel popup = new Panel() { ID = "Panel", CssClass="modalPopup" };
            HtmlGenericControl iframe = new HtmlGenericControl() { TagName = "iframe"};
            popup.Style[HtmlTextWriterStyle.Display] = "none";
            popup.Controls.Add(iframe);
            iframe.Attributes["src"] = "about:blank";
            
            // To fix when definitive CSS is done
            ModalPopupExtender extender = new ModalPopupExtender() { ID = "ModalPopupExtender", BackgroundCssClass="modalPopupBackground" };
            extender.TargetControlID = linkButton.ID;
            extender.PopupControlID = popup.ID;
            iframe.ID = iframe.Parent.ID + "IFrame";
            hyperlink.NavigateUrl = "www.google.com";
            hyperlink.Text = "Text";
            linkButton.Text = "Text";
            container.Controls.Add(hyperlink);
            container.Controls.Add(linkButton);
            container.Controls.Add(popup);
            container.Controls.Add(extender);
        
        }
    }

 

And moving the celltemplate insertion to OnInitializeLayout:

        WebGridColumn newColumn = new ISNet.WebUI.WebGrid.WebGridColumn();
        newColumn.ColumnType = ISNet.WebUI.WebGrid.ColumnType.Template;
        newColumn.CellTemplate = new cellTemplate();
        newColumn.Width = 300;
        newColumn.Caption = "Templated Column";
        WebGrid1.RootTable.Columns.Add(newColumn);

 

And the aspx will need a Script Manager. Then load the grid, go to any other page and the error will show up in the status bar.

Thanks 


All times are GMT -5. The time now is 11:37 PM.
Previous Next