0
我們正在使用Ajax控件工具包,並在頁面中放置了一個UpdatePanel。頁面佈局由母版頁控制。 UpdatePanel包含許多服務器端控件。啓動UpdatetePanel的代碼片段是:AJAX控件工具包TabContainer拋出有效值範圍外的指定參數
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<Triggers>
<asp:PostBackTrigger ControlID="btnSubmit" />
</Triggers>
在UpdatePanel中,存在一個包含大量服務器端控件的TabContainer。代碼隱藏引用它:
TabPanel TabPanel3 = new TabPanel();
TabPanel3.HeaderText = "Manually Enter Allergy";
TabContainer1.Controls.Add(TabPanel3);
for (int k = 1; k <= 6; k++)
{
//CheckBox cb1 = new CheckBox();
//cb1.ID = "cbOther" + k;
TextBox txt = new TextBox();
txt.ID = "txtAOther" + k;
txt.CssClass = "finput";
Literal lt = new Literal();
lt.Text = "<br/>" + k + ". ";
//TabPanel3.Controls.Add(cb1);
TabPanel3.Controls.Add(lt);
TabPanel3.Controls.Add(txt);
}
的TabContainer的是設置如下:
<asp:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="0">
</asp:TabContainer>
當我在本地運行這個頁面,我收到以下錯誤:
Description: 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 t
the range of valid values.
Parameter name: value
Source Error:
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.
Stack Trace:
[ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: value]
AjaxControlToolkit.TabContainer.set_ActiveTabIndex(Int32 value) +255
AjaxControlToolkit.TabContainer.OnInit(EventArgs e) +121
System.Web.UI.Control.InitRecursive(Control namingContainer) +605
System.Web.UI.Control.InitRecursive(Control namingContainer) +323
System.Web.UI.Control.InitRecursive(Control namingContainer) +323
System.Web.UI.Control.InitRecursive(Control namingContainer) +323
System.Web.UI.Control.InitRecursive(Control namingContainer) +323
System.Web.UI.Control.InitRecursive(Control namingContainer) +323
System.Web.UI.Control.InitRecursive(Control namingContainer) +323
System.Web.UI.Control.InitRecursive(Control namingContainer) +323
System.Web.UI.Control.InitRecursive(Control namingContainer) +323
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean
includeStagesAfterAsyncPoint) +2238
我很難理解錯誤被拋出的原因。初步搜索不會產生明確的行動。任何人都可以提供一些指導,說明可以採取什麼措施來糾正錯誤?
誤差是指設置ActiveTabIndex。你把它放在什麼地方? –
是的。請參閱更新後的帖子。謝謝。 – SidC