<asp:Label ID="lblstatus" Visible="false" runat="server" Text='<%# Eval("status") %>'></asp:Label>
<asp:Button ID="btnStatus" CssClass="btn" runat="server" CausesValidation="false"
CommandName="CommandStatus" Text='<%#Eval("staus1")%>' CommandArgument='<%#Eval("ArticleID")%>'
OnClientClick="return ConfirmStatus()" />
on row cammand
else if (e.CommandName == "CommandStatus")
{
int index = Convert.ToInt32(e.CommandArgument.ToString());
GridViewRow row = (GridViewRow)(((Button)e.CommandSource).NamingContainer);
Label staus = (Label)row.Cells[9].FindControl("lblstatus");
try
{
string Squery = string.Empty;
if (staus.Text.ToString().Trim() == "0")
{
Squery ="update tblArticleMasterArticles set status ='1' where articleid=" + index;
}
else
{
Squery = "update tblArticleMasterArticles set status ='0' where articleid=" + index;
}
SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.Text, Squery);
Fillgridview();
lblMsg.Text = "Status Changed Successfully.";
}
catch (Exception ex)
{
}
ER sandeep chourasia
sandeepchrs@yahoo.com (on facebook)
http://www.aspnetcodes.com/
.Netlearner, if this helps please login to Mark As Answer. | Alert Moderator