簡體   English   中英

如何在.aspx頁面中獲取c#變量(字符串)值

[英]How to get a c# variable (string) value in the .aspx page

所以有了這段代碼。

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”類型的第一個參數可以被發現(您是否缺少 using 指令或程序集引用?)

你拼錯了feedbackPostback ——你忘記了d

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM