这是一个很长的问题。我正在使用ASP.NET多视图的表单。在第二种观点,我正在收集邮政编码并进行地址查询。查找服务工作正常并返回结果。这是裸骨ASCX -
<asp:MultiView ID="multi_signup" runat="server" ActiveViewIndex="0">
<asp:View ID="mlt_Step1" runat="server">Other data collection</asp:View>
<asp:View ID="mlt_Step2" runat="server">
<asp:UpdatePanel ID="upd_Address" runat="server" ChildrenAsTriggers="true">
<ContentTemplate>
<asp:TextBox ID="txtPostcodeLookup"
ClientIDMode="Static"
runat="server" >
</asp:TextBox>
<asp:Button ID="btnPostcodeLookup" runat="server"
Text="Find Address" CausesValidation="false"
CssClass="btn btn-primary findAddress"
OnClick="FindAddress" ClientIDMode="Static" />
<asp:DropDownList ID="drp_SelectAddress"
runat="server"
AutoPostBack="true"
OnSelectedIndexChanged="PopulateAddress">
</asp:DropDownList>
<%--Address 1 --%>
<asp:TextBox ID="Address1Txt"
runat="server"
MaxLength="250">
</asp:TextBox>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnPostcodeLookup" EventName="Click" />
<asp:AsyncPostBackTrigger ControlID="drp_SelectAddress" />
</Triggers>
</asp:UpdatePanel>
</asp:View>
</asp:MultiView>
计划是,使用文本框获取邮政编码,一旦服务返回地址,填充下拉列表并将可见性设置为true。选择完成后,从下拉值填充字段的其余部分。
FindAddress
if (addressResults.Item.Count != 0)
{
drp_SelectAddress.Items.Clear();
drp_SelectAddress.Items.Add(new ListItem("--- Please Select ---", ""));
foreach (var address in addressResults.Item)
{
//Gets the actual List here
ListItem AddressOption = new ListItem();
AddressOption.Text = text.ToString();
AddressOption.Value = value;
drp_SelectAddress.Items.Add(AddressOption);
}
//This is not working. On debugger its always false!
drp_SelectAddress.Visible = true; }
所以从技术上来说,我无法设置ListItems和下拉列表的可见性......想知道为什么......
答案 0 :(得分:0)
这可能对其他人有帮助,所以在这里你去....
我正在从页面加载后面的代码中将视图索引设置为net.i2p.crypto.eddsa.EdDSAPrivateKey
。我的一位同事指出了这一点。