Click here to Skip to main content
15,945,939 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
i have a few dropdownlists on a page. in each ddl, there is a list of values and the selected values are then supposed to be stored. for some oddball reason...only one of the ddl values are being passed. completely unsure of what's wrong. just to be sure, for productDDL...i have it set so that it DISPLAYS a productName, but PASSES the productCode

aspx page:
ASP.NET
<asp:DropDownList ID="soooDDL" runat="server">
            <asp:ListItem Value="1">happy</asp:ListItem>
            <asp:ListItem Value="2">glad</asp:ListItem>
            <asp:ListItem Value="3">sad</asp:ListItem>
            <asp:ListItem Value="4">mad</asp:ListItem>
        </asp:DropDownList>

<asp:DropDownList ID="frDDL" runat="server">
            <asp:ListItem Value="CT">CT</asp:ListItem>
            <asp:ListItem Value="JT">JT</asp:ListItem>
            <asp:ListItem Value="F">F</asp:ListItem>
        </asp:DropDownList>

<asp:DropDownList ID="productDDL" runat="server" DataSourceID="productDS"
            DataTextField="productName" DataValueField="productCode">
        </asp:DropDownList>
        <asp:SqlDataSource ID="productDS" runat="server"
            ConnectionString="<%$ ConnectionStrings:connSTR %>"
            SelectCommand="SELECT * FROM [productTable]"></asp:SqlDataSource>
        <asp:Label ID="productCodeLabel" runat="server" Text="Label"></asp:Label>
</pre>


i have a busObj that stores the values.
so far...the only one that seems to store anything is the frDDL one which sends the ctjtf
C#
private string sooo_BO;
private string ctjtf_BO;
private string productCode_BO;

public string setodosou
    {
        get
        {
            return sooo_BO;
        }
        set
        {
            value = sooo_BO_BO;
        }
    }
public string ctjtf
    {
        get
        {
            return ctjtf_BO;
        }
        set
        {
            ctjtf_BO = value;
        }
    }
public string productCode
    {
        get
        {
            return productCode_BO;
        }
        set
        {
            productCode_BO = value;
        }
    }



this seems to work for ctjtf...i've tried the EXACT same code and...nothing for the other two
C#
lBO.ctjtf = frDDL.SelectedValue.ToString();

this, as i said...sends the proper value through to the busObj


focusing on just the soooDDL...
attempt 1:
C#
lBO.setodosou = soooDDL.SelectedValue;

in local...i see null value for the string even though i selected a product


attempt2:
C#
lBO.setodosou = soooDDL.SelectedValue.ToString();

in local...null value...again, this is the exact same thing i used for the ctjtfDDL and i can see that one worked just fine. there's definitely the proper value stored in memory.

attempt3:
C#
lBO.setodosou = soooDDL.SelectedItem.Value;

still...null value and what's weird here is when i write out the line, if i hover over ".Value" in codebehind, I can see that the "value" is what I selected, yet for some reason...the variable isn't being passed
Posted

1 solution

did you notice

C#
public string setodosou
    {
        get
        {
            return sooo_BO;
        }
        set
        {
            value = sooo_BO_BO;
            // Should be 
            sooo_BO = value;
        }
    }
 
Share this answer
 
Comments
memberxxxxxxxxxxxxxxxxx 9-Jan-14 16:16pm    
thanks. appreciate the help. it's always the small stupid things that get ya
bowlturner 9-Jan-14 16:39pm    
Yes it is. And ones like that usually need someone else to embarrass you with them. Glad I could help!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900