gpt4 book ai didi

asp.net - 单选按钮上的清除下拉选择索引已更改

转载 作者:行者123 更新时间:2023-12-04 06:14:38 24 4
gpt4 key购买 nike

我有一个 devexpress 日历。日历内置了按资源(在我的例子中是位置)对日历进行分组的功能。所以,我也编写了按类名和提供者创建日历组的逻辑。两个人单独工作很好。但是当我试图放置一个单选按钮列表以便用户可以选择他想要对日历进行分组的方式时,我遇到了问题。

这是我的单选按钮列表和它的事件处理程序背后的代码:

  protected  void filtertype_changed(object sender, EventArgs e)
{
if (filtertype.SelectedValue == "None")
{
// ASPxScheduler1.AppointmentDataSource = LoadAppointments();


classList.Visible = false;
providerslist.Visible = false;
classList.SelectedIndex = 0;
classList.SelectedIndex = 0;
//classList.SelectedValue = "0";
//providerslist.SelectedValue = "0";
ASPxScheduler1.GroupType = DevExpress.XtraScheduler.SchedulerGroupType.None;

}
else if (filtertype.SelectedValue == "Location")
{
// ASPxScheduler1.Dispose();


classList.Visible = false;
providerslist.Visible = false;

ASPxScheduler1.GroupType =
DevExpress.XtraScheduler.SchedulerGroupType.Resource;
}
else
{
ASPxScheduler1.GroupType = DevExpress.XtraScheduler.SchedulerGroupType.None;
classList.Visible = true;
providerslist.Visible = true;
}
}

这是我对单选按钮的标记
  <asp:RadioButtonList ID="filtertype" runat="server" 
OnSelectedIndexChanged="filtertype_changed" AutoPostBack="true" >
<asp:ListItem selected="true" Text="None" Value="None"></asp:ListItem>
<asp:ListItem Text="Location" Value="Location"></asp:ListItem>
<asp:ListItem>class Name and Provider</asp:ListItem>

</asp:RadioButtonList>
<asp:DropDownList ID="classList" runat="server" AutoPostBack="true"
Visible="false" ></asp:DropDownList>
<asp:DropDownList ID="providerslist" runat="server" AutoPostBack="true" Visible="false"
></asp:DropDownList>

classList 和 Provider List 是下拉列表。因此,当我从 Class 和 Provider 单选按钮更改为 location 或 none 单选按钮时,日历不会刷新并根据下拉列表存储值,并仅按这些值的位置对日历进行分组。因此,一旦我更改了类名和提供者,我需要将下拉列表值清除为 0(没有项目只是空白)。你能告诉我我怎么做吗?

最佳答案

在这里扔掉显而易见的东西,但是呢?:

DropDownList1.ClearSelection();
DropDownList1.Items.Clear();

关于asp.net - 单选按钮上的清除下拉选择索引已更改,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7420883/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com