C# 使用dropdownbox中的更改调用Aspx.cs中的函数
我有一个页面,在该页面中,下拉框中的值发生变化时,将在下拉框中传递相应的文本,以从数据库中获取值C# 使用dropdownbox中的更改调用Aspx.cs中的函数,c#,asp.net,.net,C#,Asp.net,.net,我有一个页面,在该页面中,下拉框中的值发生变化时,将在下拉框中传递相应的文本,以从数据库中获取值 <asp:DropDownList ID="dropid" runat="server" OnChange="Getvaluesfromaspx"></asp:DropDownList> 我希望从aspx文件调用aspx.cs中名为“Getvaluesfromaspx”的函数。 请提供帮助。使用“OnSelectedIndexChanged”事件而不是“OnChange
<asp:DropDownList ID="dropid" runat="server" OnChange="Getvaluesfromaspx"></asp:DropDownList>
我希望从aspx文件调用aspx.cs中名为“Getvaluesfromaspx”的函数。
请提供帮助。使用“OnSelectedIndexChanged”事件而不是“OnChange”事件
还将AutoPostBack属性值设置为true
<asp:DropDownList ID="dropid" AutoPostBack="true" runat="server" OnSelectedIndexChanged="Getvaluesfromaspx"></asp:DropDownList>
protected void Getvaluesfromaspx(object sender, EventArgs e)
{
//Do whatever want to do here.
}