Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Professional
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 6th, 2005, 03:50 PM
Registered User
 
Join Date: Sep 2005
Location: Columbus, OH, .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Fubar
Default placeholder controls -- pulling data

I've managed to hit a snag here -- trying to pull data BACK from a placeholder control ...num comes from a dropdown list (1-30) and creates a text box, couple labels, couple dropdowns as such

Code:
function makeclientlist(num as integer)

    placeholder.controls.clear()

    dim i as integer

   for i = 1 to num

    dim Label = new Label()
    label.id = "Client" & i
    label.text = "Client : "
    placeholder.controls.add(label)

    dim Box = new textbox()
    box.ID = "clientbox" & i
    placeholder.controls.add(box)

    dim dept = new DropDownList()
    dept.ID = "clientdeptlist" & i
    dept.items.add("Public Safety")
    dept.items.add("Utilities")
    placeholder.controls.add(dept)

    dim div = new DropDownList()
    div.ID = "clientdivlist" & i
    div.items.add("police")
    div.items.add("fire")
    div.items.add("park and recs")
    placeholder.controls.add(div)

    dim endlabel = new label()
    endlabel.id = "endlabel" & i
    endlabel.text = "<br>"
    placeholder.controls.add(endlabel)

   next i

end function
how do I go about drawing that info back ???(for an email actually) I've tried a for each ctrl in placeholder.controls but can't quite get the data a USER enters to come back to something useable.
  #2 (permalink)  
Old September 7th, 2005, 09:55 AM
Registered User
 
Join Date: Sep 2005
Location: Columbus, OH, .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Fubar
Default

hmm ...20 some views and no reply, thats not a good sign.
  #3 (permalink)  
Old September 7th, 2005, 01:45 PM
Friend of Wrox
Points: 4,332, Level: 27
Points: 4,332, Level: 27 Points: 4,332, Level: 27 Points: 4,332, Level: 27
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2003
Location: , NJ, USA.
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

What is the code you are using, and what is returned as to what is expected?

  #4 (permalink)  
Old September 7th, 2005, 03:04 PM
Registered User
 
Join Date: Sep 2005
Location: Columbus, OH, .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Fubar
Default

Code:
function clientbuild() as string

Dim ctrl

    for each ctrl in placeholder.Controls
'call this place1
            clientmessage &= ctrl.gettype.tostring() & "<BR>"

'call this place2
        if ctrl.gettype.tostring() = "System.Web.UI.WebControls.TextBox"

'this works
            dim name as string = ctrl.ID
'this does not pull what the USER has entered, ever.
            dim value as string = ctype(ctrl, textbox).text
            clientmessage &= name & value & "<br>"
        end if
    next

    return clientmessage

end function
place1 returns things like this...
System.Web.UI.WebControls.DropDownList
System.Web.UI.WebControls.DropDownList
System.Web.UI.WebControls.Label
System.Web.UI.WebControls.Label
System.Web.UI.WebControls.TextBox

place2 ONLY returns items defined in the 'population' of placeholder

IE, a user enters in "Joe Bob" for client name, selects "public safety" for the first dropdown and "police" for the second. Click submit on the page which is suppost to grab that info (along with a lot of other stuff, but it works) but leaves them blank or gives whatever I enter in during the makeclientlist function. If I add box.text = "thisneverworks" to the makeclientlist function, it'll catch that and send it ...but never what the user enters



  #5 (permalink)  
Old September 7th, 2005, 11:36 PM
Friend of Wrox
Points: 4,332, Level: 27
Points: 4,332, Level: 27 Points: 4,332, Level: 27 Points: 4,332, Level: 27
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2003
Location: , NJ, USA.
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

The code you have looks like it should work. I belive the problem may lye in this line:
Dim ctrl

I belive it needs to be:
Dim ctrl as Control

  #6 (permalink)  
Old September 8th, 2005, 08:13 AM
Registered User
 
Join Date: Sep 2005
Location: Columbus, OH, .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Fubar
Default

Still nothing. Maybe this'll help -- its the code that should grab the data... for reference, "clientmessage" is a public string thats loaded on pageload as nothing.
[code]
function clientbuild() as string

    Dim ctrl As Control

        for each ctrl in placeholder.Controls

            clientmessage &= ctrl.gettype.tostring() & "<BR>"

        if ctrl.gettype.tostring() = "System.Web.UI.WebControls.DropDownList"
            dim name as string = ctrl.ID
            dim value as string = ctype(ctrl, dropdownlist).selecteditem.value
            clientmessage &= name & value & "<br>"
        end if
    next

    return clientmessage

end function
[/code
if I were to select utilities and fire and click submit, here's the output

System.Web.UI.WebControls.Label
System.Web.UI.WebControls.TextBox
System.Web.UI.WebControls.DropDownList
clientdeptlist1Public Safety
System.Web.UI.WebControls.DropDownList
clientdivlist1police
System.Web.UI.WebControls.Label

which public safety and police are the first two items loaded into those controls. Do I have some kind of order of operation issue or do I need to somehow post those items BACK to the controls first?

  #7 (permalink)  
Old September 8th, 2005, 09:08 AM
Friend of Wrox
Points: 4,332, Level: 27
Points: 4,332, Level: 27 Points: 4,332, Level: 27 Points: 4,332, Level: 27
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2003
Location: , NJ, USA.
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

I am confused, is the problem with the code you originally posted, or the code you just posted?

 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
SSIS Not pulling data correctly chevy SQL Server 2005 0 February 26th, 2008 04:12 PM
placeholder controls rocksbhavesh ASP.NET 1.0 and 1.1 Professional 3 May 17th, 2007 08:11 AM
Ajax not pulling back data gmoney BOOK: Professional Ajax ISBN: 978-0-471-77778-6 1 August 22nd, 2006 02:31 AM
pulling data from webpage zeeonline XSLT 3 July 27th, 2006 03:04 PM
Check boxe pulling data Calibus Classic ASP Databases 3 August 7th, 2004 02:11 AM



All times are GMT -4. The time now is 07:17 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.