Last post Mar 29, 2012 01:52 AM by Hua-Jun Li - MSFT
Mar 26, 2012 12:56 PM|pritams|LINK
I have developed an aspx page on which I place AJAX TabPanel on run time and Tabcontainer. Tabs are added dynamically. Now I need to add one button to the page but it gives me error on its click event as follows:
An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: index
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
[ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: index]
System.Web.UI.ControlCollection.get_Item(Int32 index) +8665582
AjaxControlToolkit.TabPanelCollection.get_Item(Int32 index) +51
AjaxControlToolkit.TabContainer.LoadClientState(String clientState) +292
AjaxControlToolkit.ScriptControlBase.LoadPostData(String postDataKey, NameValueCollection postCollection) +120
AjaxControlToolkit.TabContainer.LoadPostData(String postDataKey, NameValueCollection postCollection) +72
AjaxControlToolkit.ScriptControlBase.System.Web.UI.IPostBackDataHandler.LoadPostData(String postDataKey, NameValueCollection postCollection) +42
System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad) +693
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1743
Mar 26, 2012 01:02 PM|kalpesh.patel|LINK
I thing you are trying to access the tab index, which does not exist.
tab Index are start from zero, I think you have started from 1
Mar 26, 2012 02:00 PM|pritams|LINK
No kalpesh thats not the problem. It gives error for any other asp control's click event and works fine for html controls
Mar 29, 2012 01:52 AM|Hua-Jun Li - MSFT|LINK
I think the reason is that you create the TabPanel dynamicly.
Make sure that dynamic tabPanels are created in Page_Init method.
You may need to recreate the tab panels when the postback occurs in the Page_init because the tabpanels do not exist on post backs until they have been made