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
"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; } | |
} | |
} | |