我想隱藏txtsearch
當RadioButtonListvalue = OrderDate
隱藏txtsearch
,如果任何其他值選擇顯示隱藏文本框基於單選按鈕列表值
顯示txtsearch
我想它下面的代碼沒有工作
if (!IsPostBack)
{
if (lblfield.SelectedValue == "OrderDate")
{
txtsearch.Visible = false;
}
else
{
txtsearch.Visible = true;
}
}
<asp:RadioButtonList ID="lblfield" runat="server" CellPadding="10" CellSpacing="10" RepeatDirection="Horizontal" AutoPostBack="true" Width="460px">
<asp:ListItem Selected="True" Value="Cust_Name">Customer</asp:ListItem>
<asp:ListItem Value="OrderDate">Order Date</asp:ListItem>
<asp:ListItem Value="TotalAmount">Total Amount</asp:ListItem>
<asp:ListItem Value="InvoiceStatus">Invoice Status</asp:ListItem>
</asp:RadioButtonList>
<asp:TextBox ID="txtsearch" runat="server" class="form-control" placeholder="Search"></asp:TextBox>
將RadioButtonList設置爲「OrderDate」的事件是什麼? –