Asp.net dropdownlistbox selectedindexchange未从Angular模板触发

时间:2018-05-28 12:03:53

标签: .net angularjs

我在角度视图(.aspx扩展名)上有2个下拉列表框。所以我想根据第一个填写第二个dropdownlistbox。但是第一个下拉列表框没有在angular视图页面上触发selectedindexchanged事件。所以请帮助我骑上它

Admission.aspx

<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" 
AutoEventWireup="true" CodeFile="admission.aspx.cs" Inherits="_Default" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContentPlaceHolder" 
Runat="Server">
<!--=========== BEGIN COURSE BANNER SECTION ================-->
<section id="imgBanner" class="imgAdmissionBanner">     
</section>
<!--=========== END COURSE BANNER SECTION ================-->
<div ng-init="noRecords=false" ng-app="myApp" ng
controller="admissionController">
<!--    Main content goes here-->
<div ng-view=""></div>
</div>
<!--Controller-->
<script src="controllers/admission/route.js"></script>
<script src="controllers/admission/admissionController.js"></script>
<script src="js/removeItems.js"></script>
</asp:Content>

当我从下拉列表中选择项目时,它不会抛出selectedindexchanged    在角度视图页面上。我认为这可能是背后的原因之一    回发。我想根据第一个ddlist的选择填充第二个ddlist    但即使在设置之后它也不会被选中    Autopostback true

Course.aspx(包含下拉列表的角度视图)

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="courses.aspx.cs" 
Inherits="courses" %>
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>       

<section>
<div class="row">
<div class=" col-sm-8 col-lg-offset-3 col-md-offset-3 col-sm-offset-3">
<div class="row">
<div class="col-lg-4 col-md-4 col-sm-4">
<div class="form-group">
<label for="sel1">Select Board/University:</label>
<asp:DropDownList DataSourceID="fetchBUName" CssClass="form-control" 
DataTextField="BU_Name" DataValueField="BU_Name" ID="ddlBUName" 
AppendDataBoundItems="true" runat="server" AutoPostBack="true">
<asp:ListItem>Select Board/University</asp:ListItem>
</asp:DropDownList>
<asp:SqlDataSource ID="fetchBUName" runat="server"  ConnectionString="<%$ 
ConnectionStrings:myConn %>" SelectCommand="spFetchBUName" 
SelectCommandType="StoredProcedure">
</asp:SqlDataSource>
</div>
</div>
<div class="col-lg-3 col-md-3 col-sm-3">
<div class="form-group">
<label for="sel1">Select Class:</label>
<asp:DropDownList CssClass="form-control" ID="ddlClassName" runat="server">                               
</asp:DropDownList>
</div>
</div>
<div class="col-lg-1 col-md-1 col-sm-1">
<label></label>
<div class="form-group">
<a href="#!pay" class="glyphicon glyphicon-shopping-cart" style="font-size: 
35px;color: lightblue;text-decoration: none"><span class="badge"> 
{{cartItems}}</span></a>
</div>
</div>
</div>
</div>
</div>  
</section>

<section id="aboutUs">
<div class="container">
<div class="row">
<!-- Start about us area -->
<div class="col-lg-12">
<div class="aboutus_area wow fadeInLeft">
<h2 class="title_two">Available Courses</h2>
<span></span> 
</div>
</div>
</div>
</div>
</section>      

<div class="row">
<div class="col-lg-8 col-lg-offset-2">
<div class="row text-center">
<div class="col-md-3" ng-repeat="book in bookList">
<div class="thumbnail">
<a href="/w3images/lights.jpg">
<img src={{book.url}} alt="Lights">
</a>
&nbsp;&nbsp;&nbsp;&nbsp;<div class="caption">
<p>{{book.subject}}</p>
<p>{{book.price}}</p>
<button class="btn btn-primary" ng-click="btnControl1($event, 
book.subject,book.price)">Add To Cart</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</form>
</body>
</html>

这是我想在selectedindexchanged event fire

之后执行的

Course.aspx.cs

protected void ddlBUName_SelectedIndexChanged(object sender, EventArgs e)
{
SqlDataReader dr;
dr = clsAddClass.fetchClassName(0, ddlBUName.SelectedValue, "spFetchBUID", 
"spFetchClassName");
ddlClassName.Items.Clear();
if (dr.HasRows)
{
ddlClassName.Enabled = true;
while (dr.Read())
{
ddlClassName.Items.Add(dr["Class_Name"].ToString());
}
ddlClassName.Items.Insert(0, "Select Class");
}
else
{
ddlClassName.Items.Add("No Class found");
ddlClassName.Enabled = false;
}
}

0 个答案:

没有答案