473,767 Members | 1,793 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

2 New Member
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 8612
Frinavale
9,735 Recognized Expert Moderator Expert
Please post the error details.
Apr 2 '09 #2
robbp
2 New Member
Thanks for the reply - i get the below error:

Offending URL: http://localhost:1583/Secured Lending Portal/Wizard/WizardPage.aspx ?Action=AmendCr eateCustomerTes t&DisplaySteps= 1
Source: System.Web.Exte nsions
Message: Extender control 'txt_PostalAddr essLine1_TextBo xWatermarkExten der' is not a registered extender control. Extender controls must be registered using RegisterExtende rControl() before calling RegisterScriptD escriptors(). Parameter name: extenderControl
Stack trace: at System.Web.UI.S criptControlMan ager.RegisterSc riptDescriptors (IExtenderContr ol extenderControl ) at System.Web.UI.S criptManager.Re gisterScriptDes criptors(IExten derControl extenderControl ) at System.Web.UI.E xtenderControl. Render(HtmlText Writer writer) at AjaxControlTool kit.ExtenderCon trolBase.Render (HtmlTextWriter writer) at System.Web.UI.C ontrol.RenderCo ntrolInternal(H tmlTextWriter writer, ControlAdapter adapter) at System.Web.UI.C ontrol.RenderCo ntrol(HtmlTextW riter writer, ControlAdapter adapter) at System.Web.UI.C ontrol.RenderCo ntrol(HtmlTextW riter writer) at System.Web.UI.C ontrol.RenderCh ildrenInternal( HtmlTextWriter writer, ICollection children) at System.Web.UI.C ontrol.RenderCh ildren(HtmlText Writer......... ............... ............... ....

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 Recognized Expert Moderator Expert
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....becau se I can't tell why you are registering the System.Web.Exte nsion 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
3733
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 the Controls.Add() method several times or even calling the Controls.AddRange() method once can take a huge amount of time. Therefore, I would like to be able to run the loop that creates the controls on a different thread and meanwhile give the user...
7
3017
by: Shimon Sim | last post by:
I have a custom composite control I have following property
3
1996
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 created new custom button called "My Custom Button" in the Outlook menu bar. But when I tried to create one more button called "Forward Mail" (code is
11
18148
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 ListView columns so it should be doable, thanks
6
11081
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 how those properties are set. I want to be able to do two other things: a) add User control instances to my page, filling in the place of placeholder controls, and b) programmatically setting custom properties on those dynamically spawned...
2
7001
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, Footer, Side bar and Body One of the content panels would use a Wizard control stepping the user through submitting an Ergonomic Review Request.
2
2213
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 the form load event. Why should it fire when I put a button in a update panel? Is this necessary and is only the other controls related to the update panel send back? Or the whole page (If this is true I really do not get it). But please answer...
5
4127
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 to wrap the control in the proper control type - which is also a container. At design time I want to be able to turn this : <my:container> <asp:textbox />
7
6669
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 tabcontainer which has 1 panel already, however I want to try create the TabPanels dynamically. I followed the advice here: http://www.asp.net/learn/ajax-videos/video-156.aspx (3rd comment - Joe Stagner)
0
9571
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10169
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10013
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9960
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9841
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6655
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5280
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3930
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3533
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.