Advertisement

05.24.2004 at 03:30PM PDT, ID: 21000673
[x]
Attachment Details

Having problems with values and drop down lists

Asked by jay-are in Microsoft Visual Basic.Net

Tags: drop, down

Hello Experts:

I previously had some help with getting a value of a drop down list when a datagrid is edited.  Here is the code I ended up using that works fine inside my datagrid:

<asp:dropdownlist id="ddlAppt" style="Z-INDEX: 139; LEFT: 536px; POSITION: absolute; TOP: 232px" Width="152px"
Runat="server" DataTextField="Appt" DataValueField="Appt" SelectedIndex='<% #DgDD5GetIDX(Container.DataItem("Appt")) %>'>
<asp:ListItem Value=' ' />
<asp:ListItem Value='Yes' />
<asp:Listitem Value='No' />
</asp:dropdownlist>

code-behind:

Function DgDD5GetIDX(ByVal Val As Object) As Integer
        If Not (Val Is Nothing) Then
            Select Case Val
                Case "Yes"
                    Return 1
                Case "No"
                    Return 2
                Case Else
                    Return 0
            End Select
        Else
            Return 0
        End If
    End Function

This is just a plain form I use for user input to a data table in sql.  This isn't in use inside a datagrid so I'm sure it needs some changing to work on a plain form.
This is the error I get:

Compiler Error Message: BC30456: 'DataItem' is not a member of 'System.Web.UI.Control'.

Source Error:

Line 39:       tabIndex="6" runat="server"></asp:textbox><asp:textbox id="TextBoxInterested" style="Z-INDEX: 107; LEFT: 208px; POSITION: absolute; TOP: 296px"
Line 40:       tabIndex="5" runat="server"></asp:textbox>
Line 41:       <asp:dropdownlist id="ddlSold" style="Z-INDEX: 106; LEFT: 536px; POSITION: absolute; TOP: 328px" tabIndex="15"
Line 42:       runat="server" Width="152px" SelectedIndex='<% #DgDD1GetIDX(Container.DataItem("Sold")) %>'>
Line 43:       <asp:ListItem Value=' ' />

Source File: c:\inetpub\wwwroot\SLN\WebForm1.aspx    Line: 41

So I just want to see the value of the drop down list when I record is retrieved into this form.  It has 5 drop down lists in all.  They all only have 2 - 3 selections, so the person who originally helped me thought this method was the easiest.  Help?!

Thanks

Start Free Trial
[+][-]05.24.2004 at 03:58PM PDT, ID: 11147372

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.24.2004 at 04:07PM PDT, ID: 11147405

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.24.2004 at 04:51PM PDT, ID: 11147580

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Microsoft Visual Basic.Net
Tags: drop, down
Sign Up Now!
Solution Provided By: mdamico
Participating Experts: 2
Solution Grade: A
 
 
[+][-]05.25.2004 at 06:16AM PDT, ID: 11151447

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.25.2004 at 08:54AM PDT, ID: 11153272

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]05.25.2004 at 11:20AM PDT, ID: 11154712

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.25.2004 at 01:23PM PDT, ID: 11155770

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.25.2004 at 02:10PM PDT, ID: 11156147

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.27.2004 at 08:22AM PDT, ID: 11172601

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32