绑定向导时出错
Error While binding wizard
下面是向导代码。
<asp:Wizard ID="Wizard1" runat="server" DisplaySideBar="false" OnNextButtonClick="Wizard1_NextButtonClick"
CssClass="" OnFinishButtonClick="Wizard1_FinishButtonClick" FinishCompleteButtonText="Publish" OnLoad="Wizard1_Load" OnInit="Wizard1_Init"
OnPreviousButtonClick="Wizard1_PreviousButtonClick" Width="100%" ActiveStepIndex="-1" EnableViewState="false" > <%--OnLoad="Wizard1_Load" OnInit="Wizard1_Init"--%>
<WizardSteps>
<asp:WizardStep ID="wzsKeyData" runat="server" Title="KeyData">
<div class="bidpost" style="padding-bottom:80px;">
<asp:PlaceHolder ID="phKeyData" runat="server"></asp:PlaceHolder>
</div>
</asp:WizardStep>
<asp:WizardStep ID="wzsTechnical" runat="server" Title="Technical">
<div class="bidpost" style="padding-bottom:80px;">
<asp:PlaceHolder ID="phTechSpecification" runat="server"></asp:PlaceHolder>
</div>
</asp:WizardStep>
<asp:WizardStep ID="wzsCommercial" runat="server" Title="Commercial">
<div class="bidpost" style="padding-bottom:135px;">
<div class="row-fluid" style="text-align:left;font-weight:bold;">
<div class="span2">
<asp:Label ID="lblBidQuote" runat="server" Text="Bid Quote"></asp:Label>
</div>
<div class="span4">
<asp:TextBox ID="txtBidQuote" runat="server" PlaceHolder="E.g. 45678" CssClass="inputMargin" MaxLength="10" style="width:180px;"></asp:TextBox>
<cc1:FilteredTextBoxExtender ID="ftxtBidQuote" runat="server" Enabled="True" TargetControlID="txtBidQuote"
ValidChars="0123456789">
</cc1:FilteredTextBoxExtender>
<asp:RequiredFieldValidator runat="server" ID="rfvtxtBidQuote" ControlToValidate="txtBidQuote" InitialValue=""
ValidationGroup="validatebid" ForeColor="Red" Display="Dynamic" ErrorMessage="Please Enter Bid Quote!" />
</div>
<div class="span2 inputMargin">
<asp:Label ID="lblDeliveryDate" runat="server" Text="Delivery Date"></asp:Label>
</div>
<div class="span4">
<asp:TextBox ID="txtDeliveryDate" placeholder="E.g. February 18, 2016" CssClass="textBox spaninner datepickr" runat="server"> </asp:TextBox>
<i class=" fa fa-calendar calendar-icon calendar-icondeliverydate" style="top:-7px;"></i>
<asp:RequiredFieldValidator runat="server" ID="rfvtxtDeliveryDate" ControlToValidate="txtDeliveryDate" InitialValue=""
ValidationGroup="validatebid" ForeColor="Red" Display="Dynamic" ErrorMessage="Please Enter Delivery Date!" />
</div>
</div>
<asp:PlaceHolder ID="phCommercial" runat="server"></asp:PlaceHolder>
</div>
</asp:WizardStep>
<asp:WizardStep ID="wzsStatutory" runat="server" Title="Statutory">
<div class="bidpost" style="padding-bottom:80px;">
<asp:PlaceHolder ID="phStatutory" runat="server"></asp:PlaceHolder>
</div>
</asp:WizardStep>
<asp:WizardStep ID="wzsOthers" runat="server" Title="Others">
<div class="bidpost" style="padding-bottom:80px;">
<asp:PlaceHolder ID="phOtherTerms" runat="server"></asp:PlaceHolder>
</div>
</asp:WizardStep>
</WizardSteps>
<HeaderTemplate>
<ul id="wizHeader" class="bidpostwizheader">
<asp:Repeater ID="SideBarList" runat="server">
<ItemTemplate>
<li><a class="<%# GetClassForWizardStep(Container.DataItem) %>" title="<%#Eval("Name")%>">
<%# Eval("Name")%></a> </li>
</ItemTemplate>
</asp:Repeater>
</ul>
</HeaderTemplate>
<StartNavigationTemplate>
<div class="wizardbottomdiv">
<asp:Button ID="StartNextButton" runat="server" CssClass="buttonNext" CommandName="MoveNext"
Text="Next" />
</div>
</StartNavigationTemplate>
<StepNavigationTemplate>
<div class="wizardbottomdiv">
<asp:Button ID="StepNextButton" runat="server" CssClass="buttonNext" CommandName="MoveNext"
Text="Next" />
<asp:Button ID="StepPreviousButton" runat="server" CssClass="buttonPrevious" CommandName="MovePrevious"
Text="Previous" />
</div>
</StepNavigationTemplate>
<FinishNavigationTemplate>
<div class="wizardbottomdiv">
<asp:Button ID="StepNextButton" runat="server" CssClass="buttonNext" CommandName="MoveComplete"
Text="Save Response" />
<asp:Button ID="StepPreviousButton" runat="server" CssClass="buttonPrevious" CommandName="MovePrevious"
Text="Previous" />
</div>
</FinishNavigationTemplate>
</asp:Wizard>
在此页面中,我显示了与 it.so 相关的服务和部分的列表,当用户单击服务时,向导会显示该服务的所有部分。
最初有 5 个固定步骤,但现在除了这五个步骤之外,我还必须从 db 添加步骤,它确实添加了这些步骤。
现在 problem.Suppose 如果服务有超过 5 个部分(6-7),那么当用户到达时,这些部分(第 6 和第 7)将从代码 behind.So 添加第 6 或第 7 部分并再次单击该服务,而不是再次填充向导,没有任何内容 happens.In 浏览器控制台显示错误,bound.Current 视图索引中的活动视图索引为 5,大于项目计数。
我几乎在 aspx 页面中尝试了 everything.Settingactivestepindex=0,page_init,Page_preinit,Page_preload,Page_load,Serviceclick 事件。
从代码 behind-in 添加向导步骤 在这种情况下,我保留了向导的结构(header 模板和导航模板),并从服务名称上的 aspx page.then 中删除了所有这 5 个固定步骤单击我添加代码中的所有这些步骤 behind.I 我还尝试在 page_init、Page_preinit、page_load 中调用此函数,因为错误建议在 page_preinit.Before 中绑定视图绑定 如果项目计数大于索引,我确保将活动步骤索引设置为 0 或旧索引。
我想在 rendering.I 之前再次加载控件视图状态的索引也尝试过将此向导的 EnableViewstate 设置为 false,但即使那样也不起作用。
我们找不到解决方案,因此我们用文字和 div 替换了向导,因为向导运行不正常
下面是向导代码。
<asp:Wizard ID="Wizard1" runat="server" DisplaySideBar="false" OnNextButtonClick="Wizard1_NextButtonClick"
CssClass="" OnFinishButtonClick="Wizard1_FinishButtonClick" FinishCompleteButtonText="Publish" OnLoad="Wizard1_Load" OnInit="Wizard1_Init"
OnPreviousButtonClick="Wizard1_PreviousButtonClick" Width="100%" ActiveStepIndex="-1" EnableViewState="false" > <%--OnLoad="Wizard1_Load" OnInit="Wizard1_Init"--%>
<WizardSteps>
<asp:WizardStep ID="wzsKeyData" runat="server" Title="KeyData">
<div class="bidpost" style="padding-bottom:80px;">
<asp:PlaceHolder ID="phKeyData" runat="server"></asp:PlaceHolder>
</div>
</asp:WizardStep>
<asp:WizardStep ID="wzsTechnical" runat="server" Title="Technical">
<div class="bidpost" style="padding-bottom:80px;">
<asp:PlaceHolder ID="phTechSpecification" runat="server"></asp:PlaceHolder>
</div>
</asp:WizardStep>
<asp:WizardStep ID="wzsCommercial" runat="server" Title="Commercial">
<div class="bidpost" style="padding-bottom:135px;">
<div class="row-fluid" style="text-align:left;font-weight:bold;">
<div class="span2">
<asp:Label ID="lblBidQuote" runat="server" Text="Bid Quote"></asp:Label>
</div>
<div class="span4">
<asp:TextBox ID="txtBidQuote" runat="server" PlaceHolder="E.g. 45678" CssClass="inputMargin" MaxLength="10" style="width:180px;"></asp:TextBox>
<cc1:FilteredTextBoxExtender ID="ftxtBidQuote" runat="server" Enabled="True" TargetControlID="txtBidQuote"
ValidChars="0123456789">
</cc1:FilteredTextBoxExtender>
<asp:RequiredFieldValidator runat="server" ID="rfvtxtBidQuote" ControlToValidate="txtBidQuote" InitialValue=""
ValidationGroup="validatebid" ForeColor="Red" Display="Dynamic" ErrorMessage="Please Enter Bid Quote!" />
</div>
<div class="span2 inputMargin">
<asp:Label ID="lblDeliveryDate" runat="server" Text="Delivery Date"></asp:Label>
</div>
<div class="span4">
<asp:TextBox ID="txtDeliveryDate" placeholder="E.g. February 18, 2016" CssClass="textBox spaninner datepickr" runat="server"> </asp:TextBox>
<i class=" fa fa-calendar calendar-icon calendar-icondeliverydate" style="top:-7px;"></i>
<asp:RequiredFieldValidator runat="server" ID="rfvtxtDeliveryDate" ControlToValidate="txtDeliveryDate" InitialValue=""
ValidationGroup="validatebid" ForeColor="Red" Display="Dynamic" ErrorMessage="Please Enter Delivery Date!" />
</div>
</div>
<asp:PlaceHolder ID="phCommercial" runat="server"></asp:PlaceHolder>
</div>
</asp:WizardStep>
<asp:WizardStep ID="wzsStatutory" runat="server" Title="Statutory">
<div class="bidpost" style="padding-bottom:80px;">
<asp:PlaceHolder ID="phStatutory" runat="server"></asp:PlaceHolder>
</div>
</asp:WizardStep>
<asp:WizardStep ID="wzsOthers" runat="server" Title="Others">
<div class="bidpost" style="padding-bottom:80px;">
<asp:PlaceHolder ID="phOtherTerms" runat="server"></asp:PlaceHolder>
</div>
</asp:WizardStep>
</WizardSteps>
<HeaderTemplate>
<ul id="wizHeader" class="bidpostwizheader">
<asp:Repeater ID="SideBarList" runat="server">
<ItemTemplate>
<li><a class="<%# GetClassForWizardStep(Container.DataItem) %>" title="<%#Eval("Name")%>">
<%# Eval("Name")%></a> </li>
</ItemTemplate>
</asp:Repeater>
</ul>
</HeaderTemplate>
<StartNavigationTemplate>
<div class="wizardbottomdiv">
<asp:Button ID="StartNextButton" runat="server" CssClass="buttonNext" CommandName="MoveNext"
Text="Next" />
</div>
</StartNavigationTemplate>
<StepNavigationTemplate>
<div class="wizardbottomdiv">
<asp:Button ID="StepNextButton" runat="server" CssClass="buttonNext" CommandName="MoveNext"
Text="Next" />
<asp:Button ID="StepPreviousButton" runat="server" CssClass="buttonPrevious" CommandName="MovePrevious"
Text="Previous" />
</div>
</StepNavigationTemplate>
<FinishNavigationTemplate>
<div class="wizardbottomdiv">
<asp:Button ID="StepNextButton" runat="server" CssClass="buttonNext" CommandName="MoveComplete"
Text="Save Response" />
<asp:Button ID="StepPreviousButton" runat="server" CssClass="buttonPrevious" CommandName="MovePrevious"
Text="Previous" />
</div>
</FinishNavigationTemplate>
</asp:Wizard>
在此页面中,我显示了与 it.so 相关的服务和部分的列表,当用户单击服务时,向导会显示该服务的所有部分。 最初有 5 个固定步骤,但现在除了这五个步骤之外,我还必须从 db 添加步骤,它确实添加了这些步骤。
现在 problem.Suppose 如果服务有超过 5 个部分(6-7),那么当用户到达时,这些部分(第 6 和第 7)将从代码 behind.So 添加第 6 或第 7 部分并再次单击该服务,而不是再次填充向导,没有任何内容 happens.In 浏览器控制台显示错误,bound.Current 视图索引中的活动视图索引为 5,大于项目计数。
我几乎在 aspx 页面中尝试了 everything.Settingactivestepindex=0,page_init,Page_preinit,Page_preload,Page_load,Serviceclick 事件。 从代码 behind-in 添加向导步骤 在这种情况下,我保留了向导的结构(header 模板和导航模板),并从服务名称上的 aspx page.then 中删除了所有这 5 个固定步骤单击我添加代码中的所有这些步骤 behind.I 我还尝试在 page_init、Page_preinit、page_load 中调用此函数,因为错误建议在 page_preinit.Before 中绑定视图绑定 如果项目计数大于索引,我确保将活动步骤索引设置为 0 或旧索引。
我想在 rendering.I 之前再次加载控件视图状态的索引也尝试过将此向导的 EnableViewstate 设置为 false,但即使那样也不起作用。
我们找不到解决方案,因此我们用文字和 div 替换了向导,因为向导运行不正常