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: 
First of all all u have to get particular control id when clicks on linkbutton. thereafter u have to know the text of link button then you to change if it is active then Inactive or active.

Ex:

```
     <asp:Button Text='<%#Eval("Type") %>' runat="server" OnClientClick="return changetext(this);" ID="btnType" />
     function changetext(cntl)
    {
        var id = cntl.id;
    var text=$('#id').val();
    var changedtext=text.toLower()=='active'?Inactive:Active;
     text.val(changedtext);
return false;
     }  

```
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>

```