I have a form which has 2 buttons "Delete" and "Edit".. on Post to check which button submitted the request... which of the 2 approaches is better and is there is any difference or both are same?
@if(isPost){
if(!Request["buttonDelete"].IsEmpty()){
//Do something
}
if(Request["btn"].Equals("buttonDelete")){
//do something
}
}
lets say you have html like this
here two buttons are there having edit and delete action. now when you submit a form on a server side you can have clicked element under form collection paramerters that you can access like
whichever element is clicked , the other element will be null
you can check like
hope that helps ! :)