2011-04-29 62 views
0

所以使用此代碼。如何在.aspx頁面中獲取c#變量(字符串)值

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'類型的第一個參數(您是否缺少使用指令或程序集引用?)

+4

第一,它的聲明和使用方式有所不同。 – 2011-04-29 00:53:42

回答

5

你拼錯了feedbackPostback - 你忘記了d

相關問題