Hi Waghmare,
Refer below sample.
HTML
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false">
<Columns>
<asp:BoundField DataField="Id" HeaderText="Id" />
<asp:BoundField DataField="Name" HeaderText="Name" />
<asp:BoundField DataField="Country" HeaderText="Country" />
<asp:TemplateField>
<ItemTemplate>
<asp:LinkButton ID="btnSave" Text="Save" runat="server" CssClass="btn btn-primary"
OnClick="OnSave" OnClientClick="DisableButton(this.id, 'Saving...')" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<link rel="stylesheet" media="screen" href='https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.0.3/css/bootstrap.min.css' />
<style type="text/css">
.btn
{
background-color: DodgerBlue;
border: none;
color: white;
cursor: pointer;
}
.btn:hover
{
background-color: #4CAF50;
}
</style>
<script type="text/javascript">
function DisableButton(btnID, newText) {
var btn = document.getElementById(btnID);
btn.disabled = true;
btn.text = newText;
}
</script>
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"),
new System.Data.DataColumn("Name"),
new System.Data.DataColumn("Country") });
dt.Rows.Add(1, "John Hammond", "United States");
dt.Rows.Add(2, "Mudassar Khan", "India");
dt.Rows.Add(3, "Suzanne Mathews", "France");
dt.Rows.Add(4, "Robert Schidner", "Russia");
GridView1.DataSource = dt;
GridView1.DataBind();
}
}
protected void OnSave(object sender, EventArgs e)
{
}
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 System.Data.DataTable = New System.Data.DataTable()
dt.Columns.AddRange(New System.Data.DataColumn(2) {
New System.Data.DataColumn("Id"),
New System.Data.DataColumn("Name"),
New System.Data.DataColumn("Country")})
dt.Rows.Add(1, "John Hammond", "United States")
dt.Rows.Add(2, "Mudassar Khan", "India")
dt.Rows.Add(3, "Suzanne Mathews", "France")
dt.Rows.Add(4, "Robert Schidner", "Russia")
GridView1.DataSource = dt
GridView1.DataBind()
End If
End Sub
Protected Sub OnSave(ByVal sender As Object, ByVal e As EventArgs)
End Sub
Screenshot