RadDropDownList OnSelectedIndexChanged事件未在服务器中触发

时间:2017-02-03 07:31:15

标签: c# asp.net visual-studio-2012 telerik cascadingdropdown

我有一个使用嵌套的下拉列表的Web应用程序。 (选择DDL1将是DDL2的参数等)。

我的问题是,当我使用Visual Studio运行我的应用程序时,此DDL1按预期工作,触发填充DDL2的SelectedIndexChanged事件。

当我向服务器发布相同的代码并访问Web应用程序时,DDL1的SelectedIndexChanged事件不会触发。

这可能是什么问题?

这是我的代码,

<telerik:RadDropDownList ID="RadDropDownList_Warehouse" runat="server" DataSourceID="SqlDataSource_Warehouse" CausesValidation="false" DataTextField="WarehouseName" DataValueField="WarehouseId" DefaultMessage="Select..." Font-Size="12px" Skin="Metro"
Width="260px" ValidationGroup="save" AutoPostBack="true" OnSelectedIndexChanged="RadDropDownList_Warehouse_SelectedIndexChanged" ViewStateMode="Enabled" EnableViewState="true">
</telerik:RadDropDownList>
<asp:SqlDataSource ID="SqlDataSource_Warehouse" runat="server" ConnectionString="<%$ ConnectionStrings:STNRequisitionConnectionString %>" SelectCommand="SELECT DISTINCT wd.WarehouseId, wd.WarehouseName, vrmpm.IsDeleted FROM WarehouseDetails AS wd INNER JOIN V_RequestMakerPermissionMatrix AS vrmpm ON wd.WarehouseId = vrmpm.WarehouseId WHERE (vrmpm.UserName = @username) AND (vrmpm.IsDeleted = 0)">
  <SelectParameters>
    <asp:ControlParameter ControlID="HiddenField1" Name="username" PropertyName="Value" />
  </SelectParameters>
</asp:SqlDataSource>
<asp:RequiredFieldValidator ID="RequiredFieldValidator_Warehouse" runat="server" ControlToValidate="RadDropDownList_Warehouse" ErrorMessage="Can not be empty!" Font-Bold="False" Font-Size="12px" ForeColor="Red" ValidationGroup="save"></asp:RequiredFieldValidator>

protected void RadDropDownList_Warehouse_SelectedIndexChanged(object sender, DropDownListEventArgs e)
{
    string message = STNLogger.CreateMessage("Warehouse Selected Index Changed Method Fired");
    STNLogger.LogFileWrite(message);
    string factory = RadDropDownList_Warehouse.SelectedText.Trim();
    List<string> buList = new List<string>();
    buList = mr.GetBUsForPlants(factory);
    RadDropDownList_BusinessUnit.DataSource = buList;
    RadDropDownList_BusinessUnit.DataBind();
}

我使用这个LogFileWrite()来查看该方法是否在服务器中完全执行但是没有。此事件不会在服务器中触发,而在Visual Studio中则触发。请帮忙!!

提前致谢。

0 个答案:

没有答案