我有以下<TEST_REQUEST>
<CITY_NAME>abc</CITY_NAME>
<STATE_NAME>xyz</STATE_NAME>
</TEST_REQUEST>
代码:
code.aspx:
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "TEST_REQUEST")
@JsonIgnoreProperties(ignoreUnknown = true)
public class TestRequest {
@XmlElement(name = "CITY_NAME")
@JsonProperty(value = "cityName")
private String city;
@JsonProperty(value = "stateName")
@XmlElement(name = "STATE_NAME")
private String state;
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
}
code.aspx.cs:
ASP.Net
我的期望:
此代码应在<asp:UpdatePanel ID="upMain" runat="server">
<ContentTemplate>
<table>
<tr>
<td>DropDownList One</td>
<td>
<asp:DropDownList ID="ddlOne" runat="server" AutoPostBack="true"
OnSelectedIndexChange="ddlOne_SelectedIndexChanged" />
</td>
<td>DropDownList Two</td>
<td>
<asp:DropDownList ID="ddlTwo" runat="server" />
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
所选索引更改时显示protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
ddlTwo.Visible = false;
}
}
protected void ddlOne_SelectedIndexChanged(object sender, EventArgs e)
{
ddlTwo.Visible = true;
}
。
实际发生的事情:
更改ddlTwo
的索引后,ddlOne
函数运行(使用debug进行测试),ddlOne
也会运行,但是当我逐步完成该过程时,属性会发生变化但是功能结束的那一刻,我想看到我的结果(即可见的ddlOne_SelectedIndexChanged
控件),没有结果。
如果有人能发现问题,请告诉我。 谢谢!
答案 0 :(得分:2)
尝试
<Triggers>
<asp:AsyncPostBackTrigger ControlID="ddlOne"
EventName="SelectedIndexChanged" />
</Triggers>
内部更新面板。
答案 1 :(得分:1)
更改此行
OnSelectedIndexChange="ddlOne_SelectedIndexChanged"
到
OnSelectedIndexChanged="ddlOne_SelectedIndexChanged"
它应该有用。