Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

adding custom control in updatepanel dynamicly

Avatar of davyquyo
davyquyo asked on
.NET ProgrammingC#
3 Comments1 Solution362 ViewsLast Modified:
Hey everyone

I try to make a control but I'm still expirementing and encountered a problem.
I experiment with making a custom ajax wizard so I made the base of that ajax wizard to see its result but somehow what I did is not rendering.

Problem with the code I writed is.
when I look at the html I can see the updatepanel div is there but nothing is inside. Everything I wirte in my AjaxWizardStep is not rendered in the updatepanel. How can I solve this problem becuase without updatepanel it works perfect.

The HTML I tried is here but somehow the text "This is a Test" is not rendered.

<ajax:AjaxWizard runat="server" ID="test">
            <WizardSteps>
                <ajax:AjaxWizardStep runat="server" ID="aws1">
                    This is a Test
                </ajax:AjaxWizardStep>
            </WizardSteps>
        </ajax:AjaxWizard>
namespace ajax.Web.UI.WebControls
{
    [ParseChildren(true)]
    public class AjaxWizard : Control
    {
        AjaxWizardStepCollection steps;

        [PersistenceModeAttribute(PersistenceMode.InnerProperty)]
        public virtual AjaxWizardStepCollection WizardSteps
        {
            get {
                if (steps == null)
                    steps = new AjaxWizardStepCollection();
                return steps;
            }
        }

        protected override void Render(HtmlTextWriter writer)
        {
            UpdatePanel up = new UpdatePanel();
            up.ID = this.ID;
            foreach (AjaxWizardStep step in steps)
            {
                up.ContentTemplateContainer.Controls.Add(step);
            }
            Controls.Add(up);
            up.RenderControl(writer);
            //base.Render(writer);
        }
    }

    public sealed class AjaxWizardStep : AjaxWizardStepBase
    {

    }

    public abstract class AjaxWizardStepBase : View
    {

    }

    public sealed class AjaxWizardStepCollection : IList
    {
        private ArrayList list = new ArrayList();

        internal AjaxWizardStepCollection() { }

        public IEnumerator GetEnumerator()
        {
            return list.GetEnumerator();
        }

        public object SyncRoot
        {
            get { return this; }
        }

        public bool IsSynchronized
        {
            get { return false; }
        }

        public int Count
        {
            get { return list.Count; }
        }

        public void CopyTo(AjaxWizardStepBase[] array, int index)
        {
            list.CopyTo(array, index);
        }

        void ICollection.CopyTo(Array array, int index)
        {
            list.CopyTo(array, index);
        }

        bool IList.IsFixedSize
        {
            get { return false; }
        }

        public bool IsReadOnly
        {
            get { return false; }
        }

        public AjaxWizardStepBase this[int index]
        {
            get { return (AjaxWizardStepBase)list[index]; }
        }

        object IList.this[int index]
        {
            get { return list[index]; }
            set { list[index] = value; }
        }

        public void RemoveAt(int index)
        {
            list.RemoveAt(index);
        }

        public void Remove(AjaxWizardStepBase ajaxWizardStep)
        {
            if (ajaxWizardStep == null)
                throw new ArgumentNullException("ajaxWizardStep");
            list.Remove(ajaxWizardStep);
        }

        void IList.Remove(object ob)
        {
            Remove((AjaxWizardStepBase)ob);
        }

        public void Insert(int index, AjaxWizardStepBase ajaxWizardStep)
        {
            list.Insert(index, ajaxWizardStep);
        }

        void IList.Insert(int index, object ob)
        {
            Insert(index, (AjaxWizardStepBase)ob);
        }

        public int IndexOf(AjaxWizardStepBase ajaxWizardStep)
        {
            if (ajaxWizardStep == null)
                throw new ArgumentNullException("ajaxWizardStep");
            return list.IndexOf(ajaxWizardStep);
        }

        int IList.IndexOf(object ob)
        {
            return IndexOf((AjaxWizardStepBase)ob);
        }

        public void Clear()
        {
            list.Clear();
        }

        public bool Contains(AjaxWizardStepBase ajaxWizardStep)
        {
            if (ajaxWizardStep == null)
                throw new ArgumentNullException("ajaxWizardStep");
            return list.Contains(ajaxWizardStep);
        }

        bool IList.Contains(object ob)
        {
            return Contains((AjaxWizardStepBase)ob);
        }

        public void Add(AjaxWizardStepBase ajaxWizardStep)
        {
            if (ajaxWizardStep == null)
                throw new ArgumentNullException("ajaxWizardStep");
            list.Add(ajaxWizardStep);
        }

        int IList.Add(object ob)
        {
            return list.Add((AjaxWizardStepBase)ob);
        }
    }
}
ASKER CERTIFIED SOLUTION
Avatar of davyquyo
davyquyo

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Commented:
This problem has been solved!
Unlock 1 Answer and 3 Comments.
See Answers