Saturday, March 24, 2012

Tab panel problems

Ok, Here's the situation.

I've made a crm with a relations section. on the relation section there are always 4 tabs. but depending on the connection links with other relations there can be added more

so i have to add the tabs programmaticly. this is no problem. but on the first tab there is a detailsview where i edit the relation details. This all works perfectly. I can see the extra tabs and it all looks nice but the problem is when i try to edit the first tab

when i programaticly add the tabs for the relations the edit function on the first tab doesnt work anymore. I also tried only adding one tab. and that doesnt works also. Any ideas?

Error:
Specified argument was out of the range of valid values.
Parameter name: index

Codebehind:
Sub Page_Load(ByVal senderAsObject,ByVal eAs EventArgs)HandlesMe.Load

If (Request.QueryString("action") = 2)Then
FormView1.ChangeMode(FormViewMode.Insert)
tab3.Enabled =False
tab4.Enabled =False
tab5.Enabled =False

Else

If IsPostBackThen

Else

Dim tempTabAs AjaxControlToolkit.TabPanel =New AjaxControlToolkit.TabPanel
tempTab.ID ="tab6"
tempTab.HeaderText ="temptab"

ajaxtab.Controls.Add(tempTab)

EndIf
EndIf

EndSub

System.ArgumentOutOfRangeException was unhandled by user code
Message="Specified argument was out of the range of valid values.\r\nParameter name: index"
Source="System.Web"
ParamName="index"
StackTrace:
at System.Web.UI.ControlCollection.get_Item(Int32 index)
at AjaxControlToolkit.TabPanelCollection.get_Item(Int32 index) in d:\E\AjaxControlToolkit\Release\AjaxControlToolkit\Tabs\TabPanelCollection.cs:line 49
at AjaxControlToolkit.TabContainer.LoadClientState(String clientState) in d:\E\AjaxControlToolkit\Release\AjaxControlToolkit\Tabs\TabContainer.cs:line 353
at AjaxControlToolkit.ScriptControlBase.LoadPostData(String postDataKey, NameValueCollection postCollection) in d:\E\AjaxControlToolkit\Release\AjaxControlToolkit\ExtenderBase\ScriptControlBase.cs:line 303
at AjaxControlToolkit.TabContainer.LoadPostData(String postDataKey, NameValueCollection postCollection) in d:\E\AjaxControlToolkit\Release\AjaxControlToolkit\Tabs\TabContainer.cs:line 444
at AjaxControlToolkit.ScriptControlBase.System.Web.UI.IPostBackDataHandler.LoadPostData(String postDataKey, NameValueCollection postCollection) in d:\E\AjaxControlToolkit\Release\AjaxControlToolkit\ExtenderBase\ScriptControlBase.cs:line 414
at System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

-------

It doesnt even come past the ispostback on the edit button click


ok got it.. needs to be on page_oninit

No comments:

Post a Comment