Asp.net 将数据设置为栅格视图中的标签

Asp.net 将数据设置为栅格视图中的标签,asp.net,Asp.net,我有一个包含标签的网格视图,希望在该网格视图中为该标签设置一个数据字符串 (Label)GridViewName.Rows[0].Cells[2].FindControl("Label_Name") = "sara"; 但我收到一个错误: Cannot implicitly convert type 'string' to 'System.Web.UI.WebControls.Label' 我该怎么办 必须如下设置标签的文本属性: Label Label_Name= (Label)

我有一个包含标签的网格视图,希望在该网格视图中为该标签设置一个数据字符串

     (Label)GridViewName.Rows[0].Cells[2].FindControl("Label_Name") = "sara";
但我收到一个错误:

Cannot implicitly convert type 'string' to 'System.Web.UI.WebControls.Label'

我该怎么办

必须如下设置标签的文本属性:

Label Label_Name= (Label)GridViewName.Rows[0].Cells[2].FindControl("Label_Name");
if(Label_Name!=null)
{

  Label_Name.Text = "sara";
}

无法将字符串分配给label控件。可能存在的重复项