Hello,
On the markup of aspx page I have the GridView with this edit row button
<asp:TemplateField ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:ImageButton ID="btnedit" runat="server"
CommandName="Edit"
ImageUrl="/aspnet/img/edit_icon.gif"
ToolTip="Edit row"
OnClientClick="if (!confirm('Confirm?')) return false;" />
</ItemTemplate>
</asp:TemplateField>
On the same page with the GridView I have also this other ImageButton
<asp:ImageButton runat="server" ID="btrila"
OnClick="btrila_Click"
ImageUrl="/aspnet/img/rila_button.gif"
CommandArgument="1"
OnClientClick="if (!confirm('You are sure?')) return false;" />
And in code-behind
protected void btrila_Click(object sender, ImageClickEventArgs e)
{
if (!String.IsNullOrEmpty(Mp.Container.sUser))
{
using (MySqlConnection myConnectionString =
new MySqlConnection(ConfigurationManager.ConnectionStrings["cn"].ConnectionString))
{
using (MySqlCommand cmd =
new MySqlCommand(sql, myConnectionString))
{
cmd.CommandType = CommandType.Text;
cmd.Connection.Open();
cmd.CommandText = "SP_ML_INS";
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("tun", Mp.Base64ForUrlDecode(Request.QueryString["un"]));
cmd.Parameters.AddWithValue("tmon", Mp.Base64ForUrlDecode(Request.QueryString["mon"]));
cmd.ExecuteNonQuery();
cmd.Connection.Close();
Page.ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert('Ok.');", true);
}
}
}
else
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert('KO');window.location='Default.aspx';", true);
}
}
I need hide the edit button of GridView when the event btrila_Click is called
What should I set for this need on?
protected void gvProducts_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
if (e.Row.DataItem != null)
{
????
}
}
}
Help me to do it.