![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Jun 2008
Posts: 2
Rep Power: 0
![]() |
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 Subhighlighted 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 SubThe 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 |
|
|
|
|
|
#2 |
|
Newbie
Join Date: Jun 2008
Posts: 2
Rep Power: 0
![]() |
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 |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
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 |