This is a migrated thread and some comments may be shown as answers.

Dynamic Controls: Sys.ArgumentException: Value must not be null for Controls and Behaviors

2 Answers 121 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Greg
Top achievements
Rank 2
Greg asked on 15 Sep 2008, 11:49 PM
I'm trying to build a Multi-View with some "Next" and "Previous" buttons in the CreateChildControls for a page (to later put into a SharePoint webpart) and while everything loads and seems to work ok, I get a javascript error:

"Sys.ArgumentException: Value must not be null for Controls and Behaviors"

I found some posts for ASP.NET AJAX in general that pointed at problems with the visibility of controls, but no matter what I did, I can't get rid of that JavaScript Error.  Has anybody run into this and know a way I can get rid of that error?

Code is below the sig...

Thanks in advanced,
Greg Andora
Littler Mendelson
Enterprise Applications & Development Team
Lead Applications Developer
http://www.linkedin.com/in/gregandora

        RadMultiPage mpage;  
        RadPageView pv;  
        Button btnPrevious;  
        Button btnNext;  
 
        protected override void CreateChildControls()  
        {  
            base.CreateChildControls();  
 
            RadAjaxPanel ajaxPanel = new RadAjaxPanel();  
 
            mpage = new RadMultiPage();  
 
            HtmlGenericControl topDiv = new HtmlGenericControl("div");  
            topDiv.ID = "topdiv";  
 
            btnPrevious = new Button();  
            btnPrevious.ID = "btnPrevious";  
            btnPrevious.Text = "Previous ";  
            btnPrevious.Click += new EventHandler(btnPrevious_Click);  
            btnPrevious.Enabled = false;  
            topDiv.Controls.Add(btnPrevious);  
 
            btnNext = new Button();  
            btnNext.ID = "btnNext";  
            btnNext.Text = "Next ";  
            btnNext.Click += new EventHandler(btnNext_Click);  
            topDiv.Controls.Add(btnNext);  
 
            for (int i = 0; i < 3; i++)  
            {  
                HtmlGenericControl bottomDiv = new HtmlGenericControl("div");  
                bottomDiv.ID = "bottomDiv" + i.ToString();  
                pv = new RadPageView();  
                Literal Lit = new Literal();  
                Lit.Text = "Page" + i.ToString();  
 
                bottomDiv.Controls.Add(Lit);  
                pv.Controls.Add(bottomDiv);  
                mpage.PageViews.Add(pv);  
 
            }  
 
            mpage.SelectedIndex = 0;  
            ajaxPanel.Controls.Add(topDiv);  
            ajaxPanel.Controls.Add(mpage);  
            form1.Controls.Add(ajaxPanel);  
        }  
 
        void btnNext_Click(object sender, EventArgs e)  
        {  
            mpage.SelectedIndex++;  
 
            if (mpage.SelectedIndex == mpage.PageViews.Count - 1)  
            { btnNext.Enabled = false; }  
            else   
            { btnNext.Enabled = true; }  
 
            if (mpage.SelectedIndex == 0)   
            { btnPrevious.Enabled = false; }  
            else   
            {btnPrevious.Enabled = true;}  
        }  
 
        void btnPrevious_Click(object sender, EventArgs e)  
        {  
            mpage.SelectedIndex--;  
 
            if (mpage.SelectedIndex == mpage.PageViews.Count - 1)  
            { btnNext.Enabled = false; }  
            else { btnNext.Enabled = true; }  
            if (mpage.SelectedIndex == 0)   
            { btnPrevious.Enabled = false; }  
            else   
            { btnPrevious.Enabled = true; }  
 
        }  
 
    }  
 

 

2 Answers, 1 is accepted

Sort by
0
Accepted
Atanas Korchev
Telerik team
answered on 16 Sep 2008, 08:56 AM
Hello Greg,

You can try assigning an ID for the tabstrip and multipage.

Regards,
Albert
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Greg
Top achievements
Rank 2
answered on 17 Sep 2008, 09:50 PM
That did it, thanks very much!!

Thanks,
Greg Andora
Littler Mendelson
Enterprise Applications & Development Team
Lead Applications Developer
http://www.linkedin.com/in/gregandora
Tags
TabStrip
Asked by
Greg
Top achievements
Rank 2
Answers by
Atanas Korchev
Telerik team
Greg
Top achievements
Rank 2
Share this question
or