我在代碼後面有一個方法(C#)並且想要在javascript中調用此方法。在Javascript中調用C#.net方法
我在C#
private void StatusSet()
{
List<StatusHandler> iListStatus = new List<StatusHandler>();
iListStatus.Add(new StatusHandler('A', "Active"));
iListStatus.Add(new StatusHandler('I', "InActive"));
iListStatus.Add(new StatusHandler('L', "All"));
if (hdnMode.Value == "i")
{
ddlStatus.DataSource = iListStatus.Take(2);
}
else
{
ddlStatus.DataSource = iListStatus.Take(3);
if (lnkBtnUpdate1.Visible == true)
{
ddlStatus.DataSource = iListStatus.Take(2);
}
}
}
JavaScript代碼:
function GetMode(modeIndex) {
if (modeIndex == 'i') {
StatusSet(); //How to Call in Javascript
}
}
有一個類似於一個HTTP://計算器.com/questions/5828803/how-to-call-code-behind-server-method-from-a-client-side-javascript-function/5828840#5828840 – 2011-05-12 12:13:05