Question: I have a linkButton in my gridview , whose text can be "Active" or "Inactive".
OnClientClick function of Link button , I want to display a dynamic message.
e.g:

**CASE 1:**

If Text of LinkButton is Active:
Then OnClientClick , I want to display a message "Convert ACTIVE into INACTIVE"

**CASE 2:**

If Text of LinkButton is InActive:
Then OnClientClick , I want to display a message "Convert INACTIVE into ACTIVE"

Answer: 
Code for you is ....

**jQuery i.e Client script**

you need to write the function as below which checks the text of the link and best on that it raise the confirm message to the end user...

```
function confirmMessage(button)
{
  if ($(button).text() =="Active")
  {
    return confirm("Convert from active to inactive");
  }
  else
  {
    return confirm("Convert from inactive to active");
  }
}

```

**Aspx**

Attach function to linkbutton as fllow..here i hard code "text=Active" which is relace by the eval function ...

```
<asp:GridView ID="GridView1"  runat="server" ShowFooter="true" AutoGenerateColumns="False" >
       <Columns>
                <asp:TemplateField>
                  <ItemTemplate>
    <asp:LinkButton ID="Button1" runat="server" Text="Active" OnClientClick="return confirmMessage(this);" />
                 </ItemTemplate>
        </Columns>
</asp:GridView>

```
this code may help u..!! template field in the gridview

```
// the below is template field in the gridview all you need to do is add  //OnClientClick="return GetSelectedRow(this) to this
     <ItemTemplate>
                          <asp:LinkButton ID="lnkSelect" runat="server"  OnClientClick="return GetSelectedRow(this)" >Select</asp:LinkButton>

                      </ItemTemplate>
//then in javascrpt just write this code
<script type="text/javascript">
    function GetSelectedRowSalesCapital(lnk) {
                var row = lnk.parentNode.parentNode;
                var rowIndex = row.rowIndex - 1;
                  var text= row.cells[RequiredColumnIndexof link].getElementsById(lnkSelect).value;
               if(text=="Active")
               {
                alert("Convert ACTIVE into INACTIVE");
                 }
                 else if(text=="Inactive")
                 {
                  alert("Convert INACTIVE into ACTIVE ");
                 }
                return false;
            }

</script>

```