Hi,
I am creating a validation for gridview row Selection.
There is a "Delete" button and a GridView, in that GridView, there is a "Select" LinkButton column.
I am trying to create a validation for that, When clicking on the "Delete" Button, If the particular row in GridViewis not selected for deleting, then it should show a alert message i.e. "First select any row to delete."
So I wrote a code for the validation:
<script type="text/javascript">
function validateGridSelection() {
var GridSelectedID = document.getElementById('<%=GridView1.ClientID%>');
if (GridSelectedID.rows.selectedIndex = -1) {
alert("First select any row to delete");
return false;
}
}
</script>
But this JavaScript is not working for this validation.
So, Please help me out to sort out this problem.
Thanks.