Hi paulrajmca,
Check this example. Now please take its reference and correct your code.
HTML
C#
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false">
<Columns>
<asp:BoundField DataField="Id" HeaderText="Id" />
<asp:BoundField DataField="Name" HeaderText="Name" />
<asp:TemplateField>
<ItemTemplate>
<asp:Button runat="server" Text="Update"
ToolTip='<%# Eval("Status").ToString().Equals("A") || Eval("Status").ToString().Equals("N/A") ? "Click to Update" : "" %>'
Enabled='<%# Eval("Status").ToString().Equals("A") || Eval("Status").ToString().Equals("N/A") %>' />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
VB.Net
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false">
<Columns>
<asp:BoundField DataField="Id" HeaderText="Id" />
<asp:BoundField DataField="Name" HeaderText="Name" />
<asp:TemplateField>
<ItemTemplate>
<asp:Button runat="server" Text="Update"
ToolTip='<%# If(Eval("Status").ToString().Equals("A") Or Eval("Status").ToString().Equals("N/A"), "Click to Update", "") %>'
Enabled='<%# Eval("Status").ToString().Equals("A") Or Eval("Status").ToString().Equals("N/A") %>' />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
Code
C#
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
System.Data.DataTable dt = new System.Data.DataTable();
dt.Columns.AddRange(new System.Data.DataColumn[3] {
new System.Data.DataColumn("Id", typeof(int)),
new System.Data.DataColumn("Name", typeof(string)),
new System.Data.DataColumn("Status",typeof(string)) });
dt.Rows.Add(1, "John Hammond", "N/A");
dt.Rows.Add(2, "Mudassar Khan", "P");
dt.Rows.Add(3, "Suzanne Mathews", "A");
dt.Rows.Add(4, "Robert Schidner", "N/A");
GridView1.DataSource = dt;
GridView1.DataBind();
}
}
VB.Net
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
If Not Me.IsPostBack Then
Dim dt As Data.DataTable = New Data.DataTable()
dt.Columns.AddRange(New Data.DataColumn(2) {
New Data.DataColumn("Id", GetType(Integer)),
New Data.DataColumn("Name", GetType(String)),
New Data.DataColumn("Status", GetType(String))})
dt.Rows.Add(1, "John Hammond", "N/A")
dt.Rows.Add(2, "Mudassar Khan", "P")
dt.Rows.Add(3, "Suzanne Mathews", "A")
dt.Rows.Add(4, "Robert Schidner", "N/A")
GridView1.DataSource = dt
GridView1.DataBind()
End If
End Sub
Screenshot