0
請溫和一點,因爲我還是一個新的Web編程和新的Ajax!asp.net:在Ajax腳本中調用代碼背後的方法
我已經創建了這個asp頁面。就像你看到有使用Ajax按鈕(LoginButton),並調用GetUsers()腳本,但在GetUsers()我要調用的方法用戶這是在我的身後代碼。所以我的問題是如何調用方法Users()在代碼後面的文件?
ASP頁:
<script runat="server" >
protected void GetUsers()
{
// How to call The User() method??????????
}
</script>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<asp:ScriptManager runat="server" ID="manager" >
</asp:ScriptManager>
<asp:UpdatePanel runat="server" ID="update1">
<ContentTemplate>
<asp:Button ID="LoginButton" runat="server" Text="Log In" OnClick="GetUsers"/>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>
後面的代碼是:
private void Users()
{
//Do a operation relates to DB
}