View Single Post
  #2 (permalink)  
Old February 22nd, 2006, 03:59 PM
jbenson001 jbenson001 is offline
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

Ok there are a few things you need to do. First create a selectedindexchanged event for the dropdown list:

    Protected Sub ddl_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs)
        'Get a refernce to the dropdownlist
        Dim ddl As DropDownList = CType(sender, DropDownList)
        Dim s As String

        'Get the selected text in the dropdown.
        s = ddl.SelectedItem.Text

        'Do something based on the text.
        Select Case s
            Case "Two"
                'Get the FormViewRow
                Dim fvr As FormViewRow = CType(ddl.Parent.Parent, FormViewRow)
                'Get the textbox(s) you need from that FormViewRow.
                Dim tb As TextBox = fvr.FindControl("DescriptionTextBox")
                tb.Enabled = False

        End Select
    End Sub

Then in the HTML view of the form, add this to the tag for the dropdownlist:
OnSelectedIndexChanged="ddl_SelectedIndexChanged"

This is telling the dropdownlist to call that sub when the index changes. (You can call it what ever you want, just make sure the HTML name matches the sub name above)

Hope this helps... Let me know if you have any questions....

Jim




Reply With Quote