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 January 13th, 2004, 11:49 AM
Registered User
 
Join Date: Jul 2003
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problems with placeholder and textboxes

I have a framepage(index.htm) which calls a 100% webform(one.aspx) which then contains two iframe webforms(a.aspx, b.aspx).

Now, in a.aspx, i have a treeview with checkboxes, next to each of the items. On check of each of these checkboxes, i pass the selected values to b.aspx, by using javascript and the top frame to pass values inbetween the pages.

For example, if the user checks on Name, Age and Gender in the treeview, i populate the same in b.aspx. Now i want to be able to let the user add conditions to these.

these conditions could be
Age : Greater than 20 and Less than 40
Gender : Male
Name : Contains Steve

But my problem is what is the best way to display Name, Age and Gender and populate a dropdown next to each of them and then based selection of each of these dropdown selected, one textbox or two textboxes should be displayed, depending on whether it is a range or a single value.

I am using a placeholder to generate columns, and row would have Age, Gender and Name, and a dropdown in the next column which would be contain the conditions. And then based on the condition, either one textbox would be made visible or two, depending on which condition is selected.

Now, i am facing this problem, as i have generated the dropdown which gets a feed from the dB, i can seem to access the individual textboxes in the placeholder.

my code is as follows:
PLACEHOLDER CODE
            ' Add Table Literal Control
            litLabelfiller = New LiteralControl
            litLabelfiller.Text = "<table border='0' width='100%' cellpadding='3' cellspacing='0'><tr><td align='left' valign='top'>"
            phCondition.Controls.Add(litLabelfiller)

            ' Add TextBox Control
            txtColumnP = New TextBox
            txtColumnP.ID = "txtColumn" & strFieldNum
            If Not FieldName = "" Then
                txtColumnP.Text = FieldName
            End If
            txtColumnP.Width = Unit.Pixel(100)
            txtColumnP.BorderWidth = Unit.Pixel(0)
            phCondition.Controls.Add(txtColumnP)

            ' Add DropDownList Control
            ddCondition = New DropDownList
            ddCondition.ID = "ddCondition" & strFieldNum
            ddCondition.AutoPostBack = True
            AddHandler ddCondition.SelectedIndexChanged, AddressOf PopulateTextBoxes
            populate_condition(ddCondition)
            phCondition.Controls.Add(ddCondition)

            ' Add TextBox Control
            txtRange1 = New TextBox
            txtRange1.ID = "txtRange1" & strFieldNum
            txtRange1.Visible = True
            txtRange1.Width = Unit.Pixel(100)
            phCondition.Controls.Add(txtRange1)

            ' Add TextBox Control
            txtRange2 = New TextBox
            txtRange2.ID = "txtRange2" & strFieldNum
            txtRange2.Visible = True
            txtRange2.Width = Unit.Pixel(100)
            phCondition.Controls.Add(txtRange2)

            ' Add Closing Table Spacer Literal Control
            litLabelfiller = New LiteralControl
            litLabelfiller.Text = "</td></tr></table>"
            phCondition.Controls.Add(litLabelfiller)

and the METHOD to access the dropdown, for example if the value of the dropdown is 8 or 9, then i need to make two textboxes visible as the condition would be a range rather than just one value.

    Sub PopulateTextBoxes(ByVal sender As Object, ByVal e As EventArgs)
        Try
            Dim c As Control
            Dim dd As DropDownList
            Dim txt1 As TextBox
            Dim txt2 As TextBox
            For Each c In phCondition.Controls
                If c.GetType Is GetType(DropDownList) Then
                    dd = CType(c, DropDownList)
                    Response.Write("Dropdown " & dd.SelectedItem.Value & "<br>")
                    If dd.SelectedItem.Value = 8 Or dd.SelectedItem.Value = 9 Then
                        Dim cName As String = CType(phCondition.FindControl("txtRange1"), TextBox).Text
                        ' this is where i need to make the txtRange1 and txtRange2 textboxes are made visible
                    Else
                        ' make only txtRange1 textboxes are made visible

                    End If
                End If
            Next
        Catch ex As Exception
            lberror.Text = ex.Message & "<br>" & ex.Source & "<br>" & ex.StackTrace
        End Try
    End Sub

any suggestions/advice is welcomed.

Thank you

 


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
Placeholder grstad ASP.NET 2.0 Basics 6 May 23rd, 2008 09:03 AM
Navigate away from a Content Placeholder slbibs SharePoint Development 0 September 4th, 2007 03:28 PM
placeholder controls rocksbhavesh ASP.NET 1.0 and 1.1 Professional 3 May 17th, 2007 08:11 AM
Can we add same gridview in Placeholder Control KamalRaturi ASP.NET 2.0 Professional 2 November 10th, 2006 10:07 AM
create an xml schema with a placeholder ruchilalla J2EE 0 May 5th, 2005 03:46 AM



All times are GMT -4. The time now is 02:21 PM.


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