<asp:CommandField DeleteText="&lt;div id=div1 onclick=&quot;javascript:return confirm('Are you sure to delete?')&quot;&gt;&#215;&lt;/div&gt;" ShowDeleteButton="True">我的asp.net 有這樣一句,我想把are you sure to delete?這個句與Resource中的資源綁定,我該如何寫??因為這個網站有幾個語言版本,英語,中文,日文
像一些textBox的text就直接這樣寫就行了TextBox.text="<%$ Resources:lang,PropertyDetails%>"

解决方案 »

  1.   

    在js中寫判斷.
    if
    else if
    else 
      

  2.   

    cs文件中写
    如果是GridView
    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
               //[0]改为具体列的索引,xxx改为资源文件中的值
                e.Row.Cells[0].Attributes.Add("onclick",string.Format("return confirm('{0}')",xxx);
            }
        }
      

  3.   

    在多语言系统中使用
    首先在App_GlobalResources新建resx资源文件。
    <asp:Literal ID="Literal1" runat="server" Text="<%$ Resources:lang,userinfo%>" />
    或者
    <%=Resources.lang.userinfo%>
    System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.CreateSpecificCulture(Request.Cookies["lang"].Value.ToString());
                    System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(Request.Cookies["lang"].Value.ToString());
                }