Wrox Programmer Forums
| 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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #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:
            ' Add Table Literal Control
            litLabelfiller = New LiteralControl
            litLabelfiller.Text = "<table border='0' width='100%' cellpadding='3' cellspacing='0'><tr><td align='left' valign='top'>"

            ' 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)

            ' Add DropDownList Control
            ddCondition = New DropDownList
            ddCondition.ID = "ddCondition" & strFieldNum
            ddCondition.AutoPostBack = True
            AddHandler ddCondition.SelectedIndexChanged, AddressOf PopulateTextBoxes

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

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

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

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)
            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
                        ' make only txtRange1 textboxes are made visible

                    End If
                End If
        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

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

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