前台 JS 获取后台C#值

//前台js 部门

 <script type="text/javascript"> $(function () { var type=<%=GetBtnType()%>; if(type==false) { $("#btnAddApprove").hide();// btnAddApprove需要显示与否的按钮 } });

//后台

public string GetBtnType() 
        {
            string type = "";
            Model.UserInfo u=(Model.UserInfo) Session["userid"];
            if(u.UserType==1)
            {
                type = "false";
            }else if(u.UserType==0)
            {
                type = "true";
            }
            return type;
        }

你可能感兴趣的:(前台js-获取后台)