
Partial Class admin_InputBox
    Inherits System.Web.UI.Page
    Public laenderkuerzel As String = "de"
    Public menueId As Integer = 1
    Private DB As New cDBADMINFunctions

    Dim hp_content As hp_content = Nothing

    

    Public Overrides Sub VerifyRenderingInServerForm(control As Control)

    End Sub
    'PreviousPage  ????

    Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
        If Not IsPostBack Then 'ERSTES MAL
            Page.Session("parentReload") = Nothing
            Page.Session("close") = Nothing
            ' Page.Session("navParent") = "admin"

            If Not Request.QueryString("lan") Is Nothing Then
                laenderkuerzel = Request.QueryString("lan")
            Else
                laenderkuerzel = "de"
            End If



            If Not Request.QueryString("menuID") Is Nothing Then
                menueId = Request.QueryString("menuID")
            Else
                menueId = 1
            End If

            hp_content = DB.qry_contentNew(menueId, laenderkuerzel)

            Page.Session("hp_content") = hp_content


        End If
    End Sub


    Protected Sub addPage_Click(sender As Object, e As EventArgs) Handles addPage.Click
    
        Dim hp_content As hp_content = Nothing
        hp_content = Page.Session("hp_content") 'sonst gehs ned, weil werte nicht geladen sind
        '   Dim title = InputBox("Bitte geben Sie den deutschen Menü-Titel an:")
        '    System.Web.HttpContext.Current.Response.Write("<SCRIPT LANGUAGE=""JavaScript"">alert('Hello this is an Alert')</SCRIPT>")
        Dim title As String = input.Text
      
        If title <> "" Then
            'Request.QueryString("menuID")
            Dim menueId As Integer = -1
            menueId = DB.insert_HPContentNew(hp_content, laenderkuerzel, title, hp_content.hp_id, hp_content.hp_instance)
            'Page.Parent.Page.Response.Redirect("admin.aspx?menuId=" & menueId & "&lan=" & laenderkuerzel)
            
            Page.Session("parentReload") = "admin.aspx?menuID=" & menueId & "&lan=" & laenderkuerzel

        Else
            MsgBox("Der Titel darf nicht leer sein!")
        End If
    End Sub
End Class
