SelecteValue of asp:ListBox is always nothing

Posted by Community Admin on 04-Aug-2018 21:19

SelecteValue of asp:ListBox is always nothing

All Replies

Posted by Community Admin on 09-Dec-2011 00:00

We have migrated a site from SF 3.6 to SF 4.3. On this site is a UserControl (ascx_ with a code behind.  The ascx renders fine.  There is a single list box on the page - see below

<asp:ListBox ID="lbLeadSources" runat="server" SelectionMode="Single" Rows="1" Width="250px"  />
                                        <asp:CustomValidator runat="server" ID="errLeadSource" Font-Bold="true" Font-Size="Smaller"
                                            Font-Italic="true" Display="Dynamic" ControlToValidate="lbLeadSources" ClientValidationFunction="ValidateReqdListBoxItem"
                                            ErrorMessage="<br />* Please select an item from the list" />     

If I view the soure of the page once rendered in the browser, there are options in the list and I can select a single option from the list. The validation also works fine.  In the code behind, the SelectedValue of the list box is always empty string.  No matter what we do it is always empty string. 

lead.LeadSourceID = this.lbLeadSources.SelectedValue;

What is the cause of this and how can we get around this?  Never had this issue with the 3.6 site.

Posted by Community Admin on 09-Dec-2011 00:00

William,

Any chance we can get a look at the code behind?

This thread is closed