Click here to Skip to main content
15,915,864 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: How to Validate Email Address in ASP.NET Pin
Deshbir Singh3-May-09 4:14
Deshbir Singh3-May-09 4:14 
AnswerRe: How to Validate Email Address in ASP.NET Pin
299353-May-09 5:38
299353-May-09 5:38 
Questiondatabase topic in asp.net Pin
ami_singh2-May-09 7:51
ami_singh2-May-09 7:51 
AnswerRe: database topic in asp.net Pin
student_rhr3-May-09 6:50
student_rhr3-May-09 6:50 
Questionajax implementation in asp.net web pages Pin
krsrinivas2-May-09 7:31
krsrinivas2-May-09 7:31 
AnswerRe: ajax implementation in asp.net web pages Pin
Abhishek Sur3-May-09 6:32
professionalAbhishek Sur3-May-09 6:32 
AnswerRe: ajax implementation in asp.net web pages Pin
saanj3-May-09 21:03
saanj3-May-09 21:03 
Question'DropDownList has a SelectedValue which is invalid because it does not exist in the list of items' Pin
alvarog012-May-09 7:13
alvarog012-May-09 7:13 
Hi, after some hours dealing with the above error message, i am afradid need help on this:

i have a DetailsView control, inside it i have some templatefields, one of them is a radiobutton list.
When, in Edit mode, the user changes the radiobutton seleccion (onselectedindexchanged = "RefreshDropDownList"), i need to recharge another templatefield wich is a DropDownList, with new values on it. The DropDownList is bounded to some ObjectDataSource and my purpose is "swap" to anthoer ObjectDataSource when the user changes the RadioButtonList selection.

The method RefreshDropDownList is:

protected void RefreshDropDownList(object sender, EventArgs e)
    {
        if (((RadioButtonList)sender).SelectedValue == "1")
        {
            if (odsAreasCU.SelectMethod != "GetAreasPubProyecto")
            {
                DropDownList ddl = ((DropDownList)dvCU.FindControl("DropDownList20"));
                ddl.DataSourceID = odsNewObjetDataSource.ID;
                ddl.DataTextField = "Name";
                ddl.DataValueField = "CodObj";
                ddl.DataBind();
            }            
        }
        else //if (((RadioButtonList)sender).SelectedValue == "2")
        {
              //...
        }
    }


When it passes over "ddl.DataBind();" line, a green arrow exception arises with the following message:

'DropDownList20 has a SelectedValue which is invalid because it does not exist in the list of items'

DropDownList20 is the one on this aspx page code:

<asp:TemplateField HeaderText="Area" SortExpression="Area">
    <EditItemTemplate>
        <asp:DropDownList ID="DropDownList20" runat="server" DataSourceID="odsAreasCU"
            DataTextField="Nombre" DataValueField="CodObj" ForeColor="#006666"
            SelectedValue= '<%#DataBinder.Eval(Container.DataItem,"Area")%>'
            Width="200px" ondatabinding="DropDownList20_DataBinding"
            ondatabound="DropDownList20_DataBound"
            onselectedindexchanged="DropDownList20_SelectedIndexChanged1"
            AppendDataBoundItems="True">
            <asp:ListItem Value="0">(sin área específica)</asp:ListItem>
        </asp:DropDownList>
    </EditItemTemplate>


Any help or suggestion on this would be appreciated, i am really dissapointed with this bug.

Greetings.
AnswerRe: 'DropDownList has a SelectedValue which is invalid because it does not exist in the list of items' Pin
saanj3-May-09 21:11
saanj3-May-09 21:11 
GeneralRe: 'DropDownList has a SelectedValue which is invalid because it does not exist in the list of items' Pin
alvarog013-May-09 22:39
alvarog013-May-09 22:39 
Questionvariables returning to null Pin
mh.3110782-May-09 6:15
mh.3110782-May-09 6:15 
AnswerRe: variables returning to null Pin
student_rhr3-May-09 6:56
student_rhr3-May-09 6:56 
Questionscan photos and documents and save it in a folder[modified] Pin
rummer2-May-09 5:31
rummer2-May-09 5:31 
QuestionLocalization and Globalization Pin
Member 42532762-May-09 4:24
Member 42532762-May-09 4:24 
QuestionListButton text align Pin
prizren2-May-09 4:02
prizren2-May-09 4:02 
QuestionAdd & Remove Textbox dynamically Pin
jknascrimz2-May-09 1:02
jknascrimz2-May-09 1:02 
AnswerRe: Add & Remove Textbox dynamically Pin
Yusuf2-May-09 1:06
Yusuf2-May-09 1:06 
QuestionHow To Write Or In Switch Case Pin
ais072-May-09 0:47
ais072-May-09 0:47 
AnswerRe: How To Write Or In Switch Case Pin
Yusuf2-May-09 0:56
Yusuf2-May-09 0:56 
GeneralRe: How To Write Or In Switch Case Pin
ais072-May-09 1:07
ais072-May-09 1:07 
QuestionDynamic textbox [modified] Pin
Ramkumar_S2-May-09 0:28
Ramkumar_S2-May-09 0:28 
AnswerRe: Dynamic textbox Pin
Yusuf2-May-09 1:04
Yusuf2-May-09 1:04 
AnswerRe: Dynamic textbox Pin
Abhijit Jana3-May-09 19:09
professionalAbhijit Jana3-May-09 19:09 
QuestionLine Break in Page.RegisterClientScriptBlock Pin
jai_1011-May-09 23:49
jai_1011-May-09 23:49 
AnswerRe: Line Break in Page.RegisterClientScriptBlock Pin
Ramesh Swaminathan1-May-09 23:57
Ramesh Swaminathan1-May-09 23:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.