0
제어권을 자바 스크립트에서 서버 측으로 매개 변수로 전달합니다.javascript에서 매개 변수로 컨트롤을 서버 측에 전달하는 방법
예컨대
[System.Web.Services.WebMethod()]
[System.Web.Script.Services.ScriptMethod()]
public static void StatusSet(string iMode, DropDownList ddList)
{
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 (iMode == "i")
{
ddList.DataSource = iListStatus.Take(3);
}
else
{
ddList.DataSource = iListStatus.Take(2);
}
}
및 클라이언트 측 코드 PageMethods.StatusSet (modeIndex, $ ("# ddlStatus")) 내 서버 측 코드;
가능한 속담은 http://stackoverflow.com/questions/331146/how-to-pass-array-from-asp-net-server-side-to-javascript-function-on-client-side이고 http://stackoverflow.com/questions/5626518/how-to-pass-javascript-var-to-server-side-on-asp-net – austinbv