hi all.
ok i have been able to create an error message - if the user tries to delete a row which has not been selected first; but it still deletes from the gridview...
void DeleteRowButton_Click(Object sender, EventArgs e)
{
LinkButton btn = sender as LinkButton;
GridViewRow row = btn.NamingContainer as GridViewRow;
if (row == GridView1.SelectedRow) {
GridView1.DeleteRow(GridView1.SelectedIndex);
// delete file from server
}
else
lblDeleteResult.Text = "Please select this file first, if you wish to delete it";
}
but the asp.net delete command- Delete="Delete From tbl....Where.......etc" deletes the file from the gridview regardless. How can one prevent the delete command from running unless the row is selected first?
p.s. the delete command is specified in the .aspx file
thanks