Hello all,

when delete button is clicked,i dont want to show the confirm message, i want to do some validation comparing with database tables. if that condition is true , i am displaying alert message, if that condition is false, then i want to show the confirm message.

suppose i am adding this line of code in the load event , it is giving confirm message , as soon as delete button is clicked.
Me.btnDelete.Attributes.Add("onClick", " return confirm('Do you want to delete the record?');")

in delete button i write these lines of code
VB Code:
  1. validation()
  2. if condition=true then
  3. //display alert message
  4. else
  5. ClientScript.RegisterStartupScript(Me.GetType(), "script", "getConfirm();", True)
  6. end if

VB Code:
  1. if page.Ispostback then
  2. //delete the record from the table
  3. end if
In this case it is deleting the record from the table then it is displaying the confirm message.

Kindly help me to solve this

Thanks