如何在.aspx页面中获取c#变量(字符串)值

时间:2011-04-29 00:52:40

标签: c# asp.net scriptlet

所以使用此代码。

public partial class SiteMaster : System.Web.UI.MasterPage
    {

        public string feedbackPostback = "false";

        protected void Page_Load(object sender, EventArgs e)
        {

        }
    }
}

如何从{

}访问feebackPostback

<script type="text/javascript">
    $(function () {
        $('.slide-out-div').tabSlideOut({
            tabHandle: '.handle',                     //class of the element that will become your tab
            pathToTabImage: 'images/feedback.gif',    //path to the image for the tab //Optionally can be set using css
            imageHeight: '122px',                     //height of tab image           //Optionally can be set using css
            imageWidth: '40px',                       //width of tab image            //Optionally can be set using css
            tabLocation: 'right',                     //side of screen where tab lives, top, right, bottom, or left
            speed: 300,                               //speed of animation
            action: 'click',                          //options: 'click' or 'hover', action to trigger animation
            topPos: '150px',                          //position from the top/ use if tabLocation is left or right
            leftPos: '20px',                          //position from left/ use if tabLocation is bottom or top
            fixedPosition: false,                      //options: true makes it stick(fixed position) on scroll
            onLoadSlideOut: <%= this.feebackPostback %>
        });

    });
</script>

目前尝试<%= this.feebackPostback %>并返回此错误:CS1061:'ASP.site_master'不包含'feebackPostback'的定义,并且没有扩展方法'feebackPostback'接受'ASP.site_master'类型的第一个参数可能找到(你错过了使用指令或汇编引用吗?)

1 个答案:

答案 0 :(得分:5)

你拼错了feedbackPostback - 你忘记了d