这是我的代码
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow) {
// DataRow data = ((DataRowView)e.Row.DataItem).Row;
string ToolTipString = Convert.ToString(e.Row.Cells[2].Text);
e.Row.Cells[2].Attributes.Add("title", ToolTipString);
Label MyLabel = (Label)e.Row.FindControl("MyLabel");
if (ToolTipString.Length < 20) {
MyLabel.Text = ToolTipString;
}
else {
MyLabel.Text = String.Format("{0}...", ToolTipString.Substring(0, 17));
MyLabel.ToolTip = ToolTipString;
}
}
}
但Convert.ToString(e.Row.Cells[2].Text);
这里总是给我“”。我的代码有什么问题吗?