gridview只顯示中文,不顯示英文

 gridview中第三列的值格式爲:“中文(英文)”、“中文|英文”

 

        protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.Cells.Count > 2)
            {
                string str = e.Row.Cells[2].Text;
                int l = str.IndexOf('(');
                if (l < 0 || (str.IndexOf('|') > 0 && l > str.IndexOf('|')))
                    l = str.IndexOf('|');
                if (l > 0)
                    str = str.Substring(0, l);
                e.Row.Cells[2].Text = str;
            }
        }

發佈了27 篇原創文章 · 獲贊 4 · 訪問量 3萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章