콤보 상자에서 사용자가 선택한대로 UpdatePanel의 텍스트 상자를 숨기려고합니다. 그것은 UpdatePanel 외부에서 잘 작동하지만 UpdatePanel 내부에 넣을 때 더 이상 작동을 멈추고 더 이상 텍스트 상자를 숨기지 않습니다. 이것에 대해 제발 도와 주실 수 있나요? 감사.UpdatePanel에 여전히 텍스트 상자가 표시됩니다.
내 코딩은 다음과 같습니다 :
<script language="javascript" type="text/javascript">
var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_endRequest(BindControls);
$().ready(function() {
BindControls();
$("#<%= ddlType.ClientID %>").change();
});
function BindControls() {
$("#<%= ddlType.ClientID %>").change(function() {
ShowHideCalendars();
});
}
function ShowHideCalendars() {
$("#trDates").toggle($("#<%= ddlType.ClientID %>").val() == "T1");
}
</script>
<asp:UpdatePanel runat="server">
<contenttemplate>
<asp:DropDownList runat="server" id="ddlType" AutoPostBack="True"
onselectedindexchanged="ddlType_SelectedIndexChanged">
<asp:ListItem>T1</asp:ListItem>
<asp:ListItem>T2</asp:ListItem>
</asp:DropDownList>
<table>
<tr>
<td>Row 1</td>
</tr>
<tr id="trDates">
<td>From: <asp:TextBox ID="TextBox1" runat="server" CssClass="dtpicker"></asp:TextBox> To: <asp:TextBox ID="TextBox2" runat="server" CssClass="dtpicker"></asp:TextBox></td>
</tr>
<tr>
<td><asp:Literal ID="ltStatus" runat="server" Text="You haven't selected."></asp:Literal></td>
</tr>
</table>
</contenttemplate>
</asp:UpdatePanel>