i have an update panel with a gridview. The gridview consists of a button column. I want everytime this button is clicked, the update panel should be refreshed. From what i have been able to achieve, the buttton works fine but i would only be able to see the effect when i refreshed the whole page again. I need to see the effect on the click event without refreshing the page. How do i make this gridview button cause partial postback
What I have tried:
<pre lang="ASP.NET"><asp:TemplateField HeaderText="Action" Visible="True">
<ItemTemplate>
<asp:Button Visible='<%# string.IsNullOrEmpty(Eval("Signout_Time").ToString()) %>' ID="out" runat="server" Text="Sign out" CommandName="SignOut" CommandArgument='<%#Eval("SN") %>' ClientIDMode="AutoID"/>
</ItemTemplate>
</asp:TemplateField>
This is the code behind.
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
Button lb = e.Row.FindControl("out") as Button;
ScriptManager.GetCurrent(this).RegisterAsyncPostBackControl(lb);
}
}
this is what the button does when i click
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "SignOut")
{
string sN = e.CommandArgument.ToString();
reg.sn = int.Parse(sN);
string sign = System.DateTime.Now.ToString("yyyy-MM-dd:HH:mm:ss");
reg.signout = sign;
reg.SignOut();
After the whole process, i want the button to update only the updatepanel.