Hi, I use girdview. and for deleting I use LinkButton in each row.
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if(e.Row.RowType == DataControlRowType.DataRow)
{
((LinkButton)e.Row.Cells[12].Controls[0]).Attributes.Add("onClick",
"return false;"
);
}
}
Now, I would expect nothing to happen when I Link Button
is clicked because OnClick
returns false
. Right?
BUT
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
if(e.CommandName=="SIL")
{
String _id = GridView1.DataKeys[Int32.Parse(e.CommandArgument.ToString())].Values["id"].ToString();
dsodeme_onkayitTableAdapters.odeme_onkayitTableAdapter _todeme = new dsodeme_onkayitTableAdapters.odeme_onkayitTableAdapter();
_todeme.DeleteQueryID(_id);
Response.Redirect("musteri_onkayit_odeme_al.aspx?username=" + lbUserName.Text);
}
}
is being invoked. The RowCommand
is running and deleting the records.
Please help me find the problem. I use Vista Home Premium and IE8. Is that the problem?