I have a GridView BoundField value that contains the user name, and in the database I have two user name one in English and the other one in Arabic, and I want to change the BoundField user name value according to the language, I tried using TemplateField with label but I cant assign label value and it gives this error message:
the name Label doesn't exist in the current context
aspx code:
<asp:TemplateField HeaderText="user name">
<ItemTemplate>
<asp:Label ID='Label' runat='server' ></asp:Label>
</ItemTemplate>
</asp:TemplateField>
aspx.cs code:
if (Convert.ToString(Session["lang"]) == "en")
{
Label.Text = reader["user_name_en"].ToString();
}
else
{
Label.Text = reader["user_name_ar"].ToString();
}