473,387 Members | 1,303 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Adding ajax extenders to custom controls added at runtime within a wizard control

2
Hi guys,

I have a problem where i have a web page (inheriting from a master page which contains the scriptmanager control) containing a dynamically created wizard control. At runtime i add the steps from custom controls i have created, basically simulating content etc. Now - when i try to add ajax extenders to the custom controls it errors out on load and says that the controls havent been registered - have scoured the web but cant seem to find any info re what the cause/solution is - help please.
Apr 1 '09 #1
3 8586
Frinavale
9,735 Expert Mod 8TB
Please post the error details.
Apr 2 '09 #2
robbp
2
Thanks for the reply - i get the below error:

Offending URL: http://localhost:1583/Secured Lending Portal/Wizard/WizardPage.aspx?Action=AmendCreateCustomerTest&Dis playSteps=1
Source: System.Web.Extensions
Message: Extender control 'txt_PostalAddressLine1_TextBoxWatermarkExtender' is not a registered extender control. Extender controls must be registered using RegisterExtenderControl() before calling RegisterScriptDescriptors(). Parameter name: extenderControl
Stack trace: at System.Web.UI.ScriptControlManager.RegisterScriptD escriptors(IExtenderControl extenderControl) at System.Web.UI.ScriptManager.RegisterScriptDescript ors(IExtenderControl extenderControl) at System.Web.UI.ExtenderControl.Render(HtmlTextWrite r writer) at AjaxControlToolkit.ExtenderControlBase.Render(Html TextWriter writer) at System.Web.UI.Control.RenderControlInternal(HtmlTe xtWriter writer, ControlAdapter adapter) at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) at System.Web.UI.Control.RenderControl(HtmlTextWriter writer) at System.Web.UI.Control.RenderChildrenInternal(HtmlT extWriter writer, ICollection children) at System.Web.UI.Control.RenderChildren(HtmlTextWrite r...........................................

The only things that would really affect the config ive listed in the below tags, for the rest ive provided a trail of code as it would move between the artefacts - would really appreciate some or other resolution - really frustrating me.

WEB.CONFIG

Expand|Select|Wrap|Line Numbers
  1. <configuration>
  2.  
  3.     "system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
  4.       "scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
  5.         "scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication">

WIZARD CONTAINER MARKUP
Expand|Select|Wrap|Line Numbers
  1. "C#" AutoEventWireup="true" CodeFile="WizardPage.aspx.cs" Inherits="SBSA.VAF.UI.Shell.Views.WizardPage" Title="WizardPage" MasterPageFile="~/Shared/DefaultMaster.master" %>
  2.  
  3. "Microsoft.Practices.Web.UI.WebControls" namespace="Microsoft.Practices.Web.UI.WebControls" tagprefix="asp" %>
  4. "../Controls/UI/Navigation/StepBar.ascx" tagname="StepBar" tagprefix="uc1" %>
  5. "System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Web.UI" TagPrefix="asp" %>
  6. "~/Controls/UI/Functions/ErrorDisplay.ascx" tagname="ErrorDisplay" tagprefix="uc2" %>
  7. "AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajax" %>
  8.  
  9. "content" ContentPlaceHolderID="DefaultContent" Runat="Server">
  10.     "text/css" rel ="Stylesheet" href="Wizard.css"  >
  11. "imgStage" runat="server" Height="70px" Width="700px">
  12.  
  13.             "PlaceHolderStepBar" runat="server">
  14.             "WizardControl" runat="server">
  15.             "PlaceHolder1" runat="server">
  16.         "ObjectContainerDataSourceWizard" runat="server">
  17.  
WIZARD CONTAINER CODE BEHIND
Expand|Select|Wrap|Line Numbers
  1. namespace SBSA.VAF.UI.Shell.Views
  2. {
  3.  
  4.     public partial class WizardPage : Microsoft.Practices.CompositeWeb.Web.UI.Page, IWizardPageView,INavigationService
  5.     {
  6.         public string workflow;
  7.         private PageFlowObject.PageFlowIndex pageFlowIndex = null;
  8.         private PageFlow pageFlow = new PageFlow();
  9.         private INavigationService _navigationService = new WebNavigationService();
  10.  
  11.         private WizardPagePresenter _presenter;
  12.         //TO DO: REMOVE. PLACED FOR TRYING TO FIND A NIGGLY PAGE ERROR/
  13.         protected override void OnError(EventArgs e)
  14.         {
  15.  
  16.             HttpContext ctx = HttpContext.Current;
  17.  
  18.             Exception exception = ctx.Server.GetLastError();
  19.  
  20.             string errorInfo =
  21.                "&lt;br>Offending URL: " + ctx.Request.Url.ToString() +
  22.                "&lt;br>Source: " + exception.Source +
  23.                "&lt;br>Message: " + exception.Message +
  24.                "&lt;br>Stack trace: " + exception.StackTrace;
  25.  
  26.             ctx.Response.Write(errorInfo);
  27.  
  28.             // --------------------------------------------------
  29.             // Clear the error 
  30.             // --------------------------------------------------
  31.             ctx.Server.ClearError();
  32.  
  33.             base.OnError(e);
  34.         }
  35.         protected void Page_PreInit(object sender, EventArgs e)
  36.         {
  37.  
  38.         }
  39.         protected void Page_Load(object sender, EventArgs e)
  40.         {
  41.  
  42.             WizardControl.NavigationButtonStyle.CssClass = "ButtonWizard";
  43.             WizardControl.FinishCompleteButtonText = "Next";
  44.             WizardControl.DisplaySideBar = false;
  45.             WizardControl.NextButtonClick += new WizardNavigationEventHandler(WizardMain_NextButtonClick);
  46.             WizardControl.ActiveStepChanged += new EventHandler(WizardControl_ActiveStepChanged);
  47.             WizardControl.PreviousButtonClick += new WizardNavigationEventHandler(WizardControl_PreviousButtonClick);
  48.             WizardControl.FinishButtonClick += new WizardNavigationEventHandler(WizardMain_FinishButtonClick);
  49.  
  50.             string workflow = Request.QueryString["Action"];
  51.  
  52.  
  53.  
  54.             //INTERNAL CONTROLS
  55.             //Building up the step Navigator
  56.             pageFlowIndex = pageFlow.GetPageFlowSteps(workflow);
  57.             //Clear the dummy steps
  58.             WizardControl.WizardSteps.Clear();
  59.  
  60.             int outofRangeIndex = 0;
  61.             try
  62.             {
  63.  
  64.                 for (int i = 0; i <= pageFlowIndex.StepCount - 1; i++)
  65.                 {
  66.                     outofRangeIndex = i;
  67.                     WizardStep ws = new WizardStep();
  68.                     ws.Title = pageFlowIndex.PageFlowSteps[i].StepName;
  69.                     ws.StepType = WizardStepType.Auto;
  70.                     WizardControl.WizardSteps.Add(ws);
  71.  
  72.  
  73.                 }
  74.             }
  75.             //M WARD. A Shameless Dirty Hack but time is against me.
  76.             catch (ArgumentOutOfRangeException)
  77.             {
  78.  
  79.                 //TO DO: Comeback and refactor
  80.                 pageFlowIndex = pageFlow.GetPageFlowSteps(workflow);
  81.                 //Clear the dummy steps
  82.                 WizardControl.WizardSteps.Clear();
  83.                 for (int x = 0; x <= outofRangeIndex - 1; x ++)
  84.                 {
  85.  
  86.                     WizardStep ws = new WizardStep();
  87.                     ws.Title = pageFlowIndex.PageFlowSteps[x].StepName;
  88.                     ws.StepType = WizardStepType.Auto;
  89.                     WizardControl.WizardSteps.Add(ws);
  90.  
  91.                 }
  92.             }
  93.  
  94.             PlaceHolder1.Controls.Add(WizardControl);
  95.  
  96.  
  97.             if (!this.IsPostBack)
  98.             {
  99.                 //this._presenter.OnViewInitialized();
  100.                 //BUILD THE STAGE STEPS FOR THE FIRST TIME
  101.                 WizardControl_StepsCreate(0);
  102.  
  103.                 }
  104.  
  105.  
  106.                 //Loading the custom control into the wizard container
  107.                 for (int i = 0; i < WizardControl.WizardSteps.Count; i++)
  108.                 {
  109.                     WizardStepBase ws = WizardControl.WizardSteps[i];
  110.                     PageFlowObject.PageFlowPage target = pageFlow.GetPageFlow(i, workflow);
  111.                     if (target.Source == null)
  112.                     {
  113.                         break;
  114.                     }
  115.                     if (i == WizardControl.ActiveStepIndex)
  116.                     {
  117.                         StageBarSource(target.StageID, target.StageStepID);
  118.                     }
  119.                     //Check to see if the next Button is to be disabled for  the submit
  120.                     if (target.OverRideNextWizardButton == "1")
  121.                     {
  122.                         WizardControl.NavigationButtonStyle.CssClass = "oculto";
  123.                     }
  124.                     Control b = null;
  125.                     b = Page.LoadControl(target.Source);
  126.                     b.ID = "PageFlowFormControl" + i;
  127.                     ws.Controls.Add(b);
  128.                     WizardControl.WizardSteps.Insert(i, ws);
  129.                 }
  130.             }
  131.  
  132.         [CreateNew]
  133.         public WizardPagePresenter Presenter
  134.         {
  135.             get
  136.             {
  137.                 return this._presenter;
  138.             }
  139.             set
  140.             {
  141.                 if (value == null)
  142.                     throw new ArgumentNullException("value");
  143.  
  144.                 this._presenter = value;
  145.                 this._presenter.View = this;
  146.             }
  147.         }
  148.  
  149.         #region CREATE STEP FUNCTION
  150.         /// <summary>
  151.         /// Creates the Stage Steps
  152.         /// </summary>
  153.         /// <param name="currentStep"></param>
  154.         void WizardControl_StepsCreate(int currentStep)
  155.         {
  156.  
  157.             ///DISPLAY CONTROLS//
  158.             ///*STEP BAR / Navigator*/
  159.             if (pageFlowIndex.DisplaySteps == "0")
  160.             {
  161.                 StringBuilder sb = new StringBuilder();
  162.                 sb.Append("&lt;tr>");
  163.                 Table TableSteps = new Table();
  164.                 TableSteps.Rows.Add(new TableRow());
  165.  
  166.                 int x = 0;
  167.                 foreach (WizardStep w in WizardControl.WizardSteps)
  168.                 {
  169.                     TableCell tc = new TableCell();
  170.  
  171.                     if (currentStep == x)
  172.                     {
  173.                         tc.CssClass = "StepBarCurrent";
  174.                     }
  175.  
  176.                     tc.Text = "&lt;span class='LargeFont'><strong>Step " + (x + 1) + "&lt;/strong></span><br/>";
  177.                     tc.Text += "&lt;div class='SmallFont'>" + w.Title + "&lt;/div>";
  178.                     TableSteps.Rows[0].Cells.Add(tc);
  179.  
  180.                     if (w.StepType != WizardStepType.Finish)
  181.                     {
  182.                         tc = new TableCell();
  183.                         tc.BackColor = System.Drawing.Color.Silver;
  184.                         TableSteps.Rows[0].Cells.Add(tc);
  185.                     }
  186.                     x++;
  187.                 }
  188.                 PlaceHolderStepBar.Controls.Add(TableSteps);
  189.                 //// /*END STEPBAR*/
  190.             }
  191.         }
  192.  
  193.         #endregion
  194.  
  195.  
  196.         #region Wizard control events
  197.  
  198.         void WizardControl_PreviousButtonClick(object sender, WizardNavigationEventArgs e)
  199.         {
  200.             WizardControl.ActiveStepIndex = (e.CurrentStepIndex -1);
  201.             WizardControl_StepsCreate(e.CurrentStepIndex - 1);
  202.  
  203.         }
  204.  
  205.         void WizardControl_ActiveStepChanged(object sender, EventArgs e)
  206.         {
  207.  
  208.  
  209.  
  210.         }
  211.  
  212.         public void WizardMain_NextButtonClick(object sender, WizardNavigationEventArgs e)
  213.         {
  214.  
  215.  
  216.             WizardControl_StepsCreate(e.NextStepIndex);
  217.  
  218.             if ((pageFlowIndex.StepCount - 1) == WizardControl.ActiveStepIndex)
  219.             {
  220.                 NavigateAction(Screen.NavWizard, pageFlowIndex.FinalRoute.ToString());
  221.             }
  222.             else 
  223.             {
  224.                 WizardControl.ActiveStepIndex = e.NextStepIndex;
  225.             }   
  226.  
  227.  
  228.         }
  229.  
  230.         protected void WizardMain_FinishButtonClick(object sender, WizardNavigationEventArgs e)
  231.         {
  232.  
  233.             NavigateAction(Screen.NavWizard, pageFlowIndex.FinalRoute.ToString());
  234.         }
  235.  
  236. #endregion
  237.  
  238.         public void StageBarSource(string StageID,string StageStepID)
  239.         {
  240.            this.imgStage.Attributes.Add("src","generateStageImage.aspx?workflowStage=" + StageID + "&workflowstageStep=" + StageStepID);
  241.         }
AN EXAMPLE OF CUSTOM CONTROL LOADED IN AT RUNTIME
HTML MARKUP WITH WATERMARK AS EXAMPLE OF ERROR
Expand|Select|Wrap|Line Numbers
  1. <%@ Control Language="C#" AutoEventWireup="true" CodeFile="Application_CustomerAddressDetails.ascx.cs" Inherits="SBSA.VAF.UI.VAF.Views.Application_CustomerAddressDetails" %> 
  2. <%@ Register Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Web.UI" TagPrefix="asp" %>
  3.  
  4. <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajax" %> 
  5. <%@ Register Assembly="Microsoft.Practices.Web.UI.WebControls" namespace="Microsoft.Practices.Web.UI.WebControls" tagprefix="pp" %>
  6.  
  7. <%@ Register Assembly="Microsoft.Practices.EnterpriseLibrary.Validation.Integration.AspNet" Namespace="Microsoft.Practices.EnterpriseLibrary.Validation.Integration.AspNet" TagPrefix="EntLibValidators"%> 
  8. <%@ Register src="~/Controls/UI/Functions/ErrorDisplay.ascx" tagname="ErrorDisplay" tagprefix="uc1" %>
  9.  
  10. <link href="../../../Wizard/Wizard.css" rel="Stylesheet" type="text/css" /> 
  11. <table align="left" cellpadding="0" cellspacing="0" width="100%">
Apr 2 '09 #3
Frinavale
9,735 Expert Mod 8TB
Well you're web.config looks messed up to me.
I'm not sure if it's just how you have copy/pasted it but it should look like:
Expand|Select|Wrap|Line Numbers
  1. <configuration>
  2. <configSections>
  3.         <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
  4.             <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
  5.                 <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
  6.  
  7.  
  8. ..................
  9.  
In fact, a lot of your code seems to be cut off.....

Could you please post your code again for your web.config and for the Wizard Container Markup....because I can't tell why you are registering the System.Web.Extension here.....??

Your code may have been cut of by the forum in order to protect against potential harmful data so make sure you post your code in tags.
Apr 2 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: avivgur | last post by:
Hello, I am writing a program in Visual C# and I have encountered a problem. In my program I want to dynamically create a multitude of controls (thousands) on a form. The problem is that calling...
7
by: Shimon Sim | last post by:
I have a custom composite control I have following property
3
by: Kannan | last post by:
Hi, I am trying to created Outloook Add-in Com in outlook using C#. I have seen this URL for developing this sample http://support.microsoft.com/?kbid=302901 When I executed this program it...
11
by: Pete Kane | last post by:
Hi All, does anyone know how to add TabPages of ones own classes at design time ? ideally when adding a new TabControl it would contain tab pages of my own classes, I know you can achieve this with...
6
by: | last post by:
I have made some user controls with custom properties. I can set those properties on instances of my user controls, and I have programmed my user control to do useful visual things in response to...
2
by: BJ | last post by:
I had this crazy idea. We have an existing application that could use some rework. I was going to redo the application (currently ASP.Net 1.1) using ASP.Net 2.0: Master page with Header,...
2
by: =?Utf-8?B?VG9u?= | last post by:
Hello, I want to understand teh benefits of ajax technology. Does anyone has a good website where AJAX EXTENSIONS is worked out so I really understand it. There a 2 main questions: 1) How about...
5
by: gerry | last post by:
I am trying to create a custom container control that will only ever contain a specific type of control. At design time, when a control of a different type is added to the container I would like...
7
by: RichB | last post by:
I am trying to get to grips with the asp.net ajaxcontrol toolkit, and am trying to add a tabbed control to the page. I have no problems within the aspx file, and can dynamically manipulate a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.