我对RadioButton CheckedChanged有点疑问。我有三个单选按钮,一个RadDatePicker,一个文本框和一个按钮。我只是尝试使用文本框中给出的值来搜索数据,具体取决于所选的单选按钮。我的问题是第三个单选按钮,它是" dateCreated"。我想在选择第三个单选按钮时启用RadDatePicker。我还需要在后面的代码中执行此操作,而不是使用Javascript或任何其他方法。请帮助。
这是我的代码:
的.aspx
<table>
<tr>
<td style="font-family: Calibri; font-weight: 400; font-style: normal; text-transform: none; color: #FFFFFF;" colspan="2">
</td>
<td class="style19" align="left" colspan="2" style="font-family: Calibri; font-weight: 400; font-style: normal; text-transform: none; color: #FFFFFF">
<asp:Label ID="searchTitle" runat="server" CssClass="style47" Font-Bold="False" Font-Names="Traditional Arabic" Font-Size="Medium" Font-Strikeout="False" ForeColor="#006699" Style="font-size: x-large; font-family: 'Myriad Pro'" Text="Search Non-Disclosure Document"></asp:Label>
</td>
</tr>
</table>
<table style="font-family: Calibri">
<tr>
<td class="style75">
</td>
</tr>
<tr>
<td class="style81">
</td>
<td class="style84">
</td>
<tr>
<td bgcolor="#EEF4FD" class="style77">
<asp:Label ID="ndaSearchTitle" runat="server" Text="Search NDA by :"></asp:Label>
</td>
<td bgcolor="#EEF4FD" class="style87">
</td>
<td bgcolor="#EEF4FD" class="style83">
<asp:RadioButton ID="nameSearch" runat="server" Checked="true" GroupName="searchRad" Text="Company Name" />
</td>
</tr>
<tr>
<td bgcolor="#EEF4FD" class="style77">
</td>
<td bgcolor="#EEF4FD" class="style87">
</td>
<td bgcolor="#EEF4FD" class="style83">
<asp:RadioButton ID="countrySearch" runat="server" GroupName="searchRad" Text="Country Incorperated" />
</td>
</tr>
<tr>
<td bgcolor="#EEF4FD" class="style77">
</td>
<td bgcolor="#EEF4FD" class="style87">
</td>
<td bgcolor="#EEF4FD" class="style83">
<asp:RadioButton ID="dateSearch" runat="server" GroupName="searchRad" Text="Date Created" oncheckedchanged="dateSearch_CheckedChanged" />
<telerik:RadDatePicker ID="RadDatePicker2" runat="server"
DateInput-DateFormat="dd-MM-yyyy" Skin="Default" style="margin-left: 0px" Width="45%" Enabled="false">
</telerik:RadDatePicker>
</td>
</tr>
<tr>
<td bgcolor="#93B4DF" class="style3" colspan="3" style="font-family: Calibri; font-size: large; font-weight: normal; height:20px;">
</td>
</tr>
<tr>
<td bgcolor="#EEF4FD" class="style77">
</td>
<td bgcolor="#EEF4FD" class="style87">
</td>
<td bgcolor="#EEF4FD" class="style83">
<asp:TextBox ID="ndaSearchBox" runat="server" Width="350px"></asp:TextBox>
<asp:Button ID="btnSearch" runat="server" Text="Search" />
</td>
</tr>
</tr>
</table>
aspx.cs
protected void dateSearch_CheckedChanged(object sender, EventArgs e)
{
if (dateSearch.Checked == true)
{
RadDatePicker2.Enabled = true;
}
else
{
RadDatePicker2.Enabled = false;
}
}
答案 0 :(得分:0)
尝试添加autopostback属性alos
<asp:RadioButton ID="dateSearch" runat="server" GroupName="searchRad" Text="Date Created" oncheckedchanged="dateSearch_CheckedChanged" autopostback="true" />