Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jun 6th, 2008, 5: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
Old Jun 6th, 2008, 7:54 AM   #2
minus4
Newbie
 
Join Date: Jun 2008
Posts: 2
Rep Power: 0 minus4 is on a distinguished road
Re: change button in ajax update panel to post normal way

worked it out.

in the main div, after the first update panel you have to add another update panel
and set its updatemode to conditional.

then you can create your elements
add them to updatepanel2
then update the panel, not sure if i need to update or not
but i put it in there anyway.

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

            updatepanel2.ID = "updatepanel2"
            updatepanel2.UpdateMode = UpdatePanelUpdateMode.Conditional

            mydiv(5).Controls.Add(updatepanel2)

            divContainer.Controls.Add(ltrl(4))
            divContainer.Controls.Add(mydiv(5))

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

        System.Threading.Thread.Sleep(500)

        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)

        updatepanel2.ContentTemplateContainer.Controls.Add(itemdiv(0))

        updatepanel2.Update()

    End Sub
minus4 is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
very simple question. make button change number in edit box nickm Delphi 2 Apr 29th, 2006 10:47 PM
How to post a question nnxion C++ 0 Jun 3rd, 2005 8:55 AM
How to post a question nnxion C 0 Jun 3rd, 2005 8:55 AM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 2:45 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC