View Single Post
Old Jun 6th, 2008, 6:29 AM   #1
minus4
Newbie
 
Join Date: Jun 2008
Posts: 2
Rep Power: 0 minus4 is on a distinguished road
change button in ajax update panel to post normal way

hi there, im transfering from ASP classic to vb.net and i write in complete code behind
i am doing a search by select box where you first choose group --> ajax then fills and shows categories --- > fills sub categories --> fills types like so.

all works great, however there is not allways a sub category or there may not be types, so it is then that i show a button to say show products.

my problem is that my button still does an ajax post so i am unable to add the products to the page.

can someone advice on how to either add new items to an update panel, or how to page the button post the traditional way.

Thanks

see below for code:

Public Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
        Dim user As New LUMINAR.user
        If user.checklogin() = True Then
            Dim myuserinfo = user.readcookie

            ReDim mydiv(5)
            ReDim ltrl(8)

            scriptcontrol.ID = "scriptmanager1"
            divContainer.Controls.Add(scriptcontrol)

            mydiv(0) = New HtmlGenericControl("div")
            mydiv(1) = New HtmlGenericControl("div")
            mydiv(2) = New HtmlGenericControl("div")
            mydiv(3) = New HtmlGenericControl("div")
            mydiv(4) = New HtmlGenericControl("div")
            mydiv(5) = New HtmlGenericControl("div")

            mydiv(0).ID = "dropbox1"
            mydiv(1).ID = "dropbox2"
            mydiv(2).ID = "dropbox3"
            mydiv(3).ID = "dropbox4"
            mydiv(4).ID = "dropbox5"
            mydiv(5).ID = "divresults"


            btn.ID = "btn"
            btn.Text = "Show Items"
            btn.Visible = False

            lbltest.ID = "lbltest"
            lbltest.Text = "hghj"
            lbltest.Visible = False

            mydiv(4).Controls.Add(btn)
            mydiv(4).Controls.Add(lbltest)
            updatepanel.ContentTemplateContainer.Controls.Add(mydiv(4))

            divContainer.Controls.Add(updatepanel)

            ltrl(4) = New Literal
            ltrl(4).Text = "<br style='clear:both;' />"
            divContainer.Controls.Add(ltrl(4))
            divContainer.Controls.Add(mydiv(5))

        Else
            Response.Redirect("default.aspx")
        End If
    End Sub

highlighted is the code i use to create a button and add this to the page
then i create a <BR> then i create a div i wish to fill with content mydiv(5)

I have missed out all the dropdown boxes code as this is not needed.

below is my sub i have tried calling, that works but does not add new content to mydiv(5)

    
Protected Sub showitems_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn.Click

        System.Threading.Thread.Sleep(500)

        lbltest.Text = "Tested"
        lbltest.Visible = True

        Dim itemdiv(5) As HtmlGenericControl

        itemdiv(0) = New HtmlGenericControl("div")
        itemdiv(0).ID = "1004276"
        Dim literal As New Literal
        literal.Text = "Please click on an item to create.<br />"

        itemdiv(0).Controls.Add(literal)

        mydiv(5).Controls.Add(itemdiv(0))

    End Sub

The label will update as the label is allready there, what i want to see is new
content appear in the form of product thumbnails, based on the dropdown options picked.

would be very grateful for your help

thanks
minus4 is offline   Reply With Quote