Try this
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
var MONTH_COLUMN_SELL = 8;
e.Row.Cells[MONTH_COLUMN_SELL].ToolTip = getMonthName(e.Row.Cells[MONTH_COLUMN_SELL].Text);
}
}
private string getMonthName(string monthCode)
{
string monthName = string.Empty;
switch (monthCode)
{
case "M":
monthName="Monday";
break;
}
return monthName;
}
Here is another method to do this, you have to modify your grid view binding way using Template field
<asp:TemplateField HeaderText="ClearanceNumber">
<ItemTemplate>
<asp:Label ID="lblClearanceNumber" runat="server"
Text='<%# Eval("ClearanceNumber") %>'
Tooltip='<%# Eval("ClearanceNumber") %>'>
</asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Days">
<ItemTemplate>
<asp:Label ID="lblDays" runat="server"
Text='<%# Eval("Days") %>'
Tooltip='<%# getMonthName(Eval("Days")) %>'>
</asp:Label>
</ItemTemplate>
</asp:TemplateField>
In code behind
protected string getMonthName(string monthCode)
{
string monthName = string.Empty;
switch (monthCode)
{
case "M":
monthName = "Monday";
break;
case "T":
monthName = "Tuesday";
break;
case "W":
monthName = "Wednesday";
break;
case "Th":
monthName = "Thursday";
break;
case "F":
monthName = "Friday";
break;
case "S":
monthName = "Saturday";
break;
case "Su":
monthName = "Sunday";
break;
}
return monthName;
}
please check this method scope is
protected