Hi,
I have entered this condition in my dataset
- when the value of message is equal to "1" it is not possible to continue working on this webpage.
- when the value of message is equal to "0" it's possible to continue but it's not possible to edit the gridview data.
if (message == 1)
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert('test msg 1');window.location='Default.aspx';", true);
return null;
}
else if (message == 0)
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert('test msg 2');", true);
btrila.Visible = false;
btnreset.Visible = true;
return dsProducts;
}
else
{
return dsProducts;
}
when the value of message is equal to "0" I need hide or disable the button below for edit the gridview data
<ItemTemplate>
<asp:ImageButton ID="btnedit" runat="server" CommandName="Edit"
ImageUrl="/aspnet/img/edit_icon.gif" ToolTip="Edit" />
</ItemTemplate>
I have tried this solution in RowDataBound without success because the "btnedit" is always hidden.
Any help would greatly appreciate.
Thank you.
protected void gvProducts_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
if (e.Row.DataItem != null)
{
if (btnreset.Visible == true)
{
gvProducts.Columns[2].Visible = false;
}
else
{
gvProducts.Columns[2].Visible = true;
}
}
}
}