Hi endra,
I have created sample that full fill your requirement.
HTML
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<center>
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="CategoryID"
OnRowCommand="GridView1_RowCommand">
<Columns>
<asp:TemplateField HeaderText="CategoryName" SortExpression="CategoryName">
<ItemTemplate>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Eval("CategoryID") %>'></asp:Label>
<asp:Label ID="lblMessage" runat="server" Text="your data submited successfully or try again"
Visible="false" ForeColor="Red"></asp:Label>
<asp:TextBox ID="TextBox1" runat="server" Text=""></asp:TextBox>
<asp:Button ID="Button1" Text="send" runat="server" CommandName="sendMsg" />
</ContentTemplate>
</asp:UpdatePanel>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</center>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript">
$(function () {
$('[id*=GridView1] [id*=Button1]').click(function () {
setTimeout(function () { $("[id*=lblMessage]").hide(); }, 2000);
});
var prm = Sys.WebForms.PageRequestManager.getInstance();
if (prm != null) {
prm.add_endRequest(function (sender, e) {
if (sender._postBackSettings.panelsToUpdate != null) {
$('[id*=GridView1] [id*=Button1]').click(function () {
setTimeout(function () { $("[id*=lblMessage]").hide(); }, 2000);
});
}
});
};
});
</script>
</asp:Content>
Code
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
DataTable dt = new DataTable();
dt.Columns.AddRange(new DataColumn[1] { new DataColumn("CategoryID") });
dt.Rows.Add(1);
dt.Rows.Add(2);
dt.Rows.Add(3);
dt.Rows.Add(4);
GridView1.DataSource = dt;
GridView1.DataBind();
}
}
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
Button row = (Button)e.CommandSource;
if (e.CommandName == "sendMsg")
{
Label lbl = (row.NamingContainer.FindControl("lblMessage") as Label);
lbl.Visible = true;
}
}
Screenshot
