Imports EDSL.Entities
Imports EDSL.DAL
Public Partial Class CategoryDeleteControl
  Inherits System.Web.UI.UserControl

  Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    If IsPostBack = False then
      txtID.Value = Request.QueryString("id")
      lblName.Text = Request.QueryString("idtext")
      txtParentCategory.Value = Request.QueryString("id")
    End If
  End Sub
  Protected Sub btnDelete_click(ByVal sender As Object, ByVal e As System.EventArgs) handles btnDelete.Click 
    Call Deleteit(txtID.Value)
  End Sub
  Private Sub Deleteit(byval intID as Integer )
    Dim objMainAdmin As new dbmainCategory
    if objMainAdmin.DeleteItem(intID, txtParentCategory.Value, session("passover")) = True then
      Response.Redirect("List.aspx?cid=" & Request.QueryString("cid"))
    Else
      divErrorPanel.InnerHtml = "Error deleting Category item"
    End If
  End Sub
  Protected Sub btnBack_click(ByVal sender As Object, ByVal e As EventArgs) Handles btnBack.Click
     If Request.QueryString("r") = "e" then
      Response.Redirect("Edit.aspx?id=" & txtID.Value)
    Else
      Response.Redirect("List.aspx")
    End If
  End Sub
End Class