Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

When I bind my asp.net dropdownlist control I get the error "System.Web.HttpException was unhandled by user code"??

Posted on 2009-06-30
6
293 Views
Last Modified: 2013-12-17
I have written the attached code within the edititemtemplate of my asp.net 3.5 listview control. For some reason I seem to get the error: "System.Web.HttpException was unhandled by user code"?? I have used this kind of binding before with no issues, the only difference this time being that my page is being populated by a value from the query string.

Thanks.
<asp:DropDownList 
                                                    ID="InterviewerEditDDL" 
                                                    runat="server" 
                                                    DataSourceID="InterviewerEditDataSource" 
                                                    DataTextField="InterviewerName" 
                                                    DataValueField="InterviewerID" 
                                                    CssClass="ddlTxtBoxInterviewer" 
                                                    SelectedValue='<%# Bind("InterviewerID") %>'>
                                                </asp:DropDownList>
                                                <asp:LinqDataSource 
                                                    ID="InterviewerEditDataSource" 
                                                    ContextTypeName="HRsystemDataContext" 
                                                    TableName="ApplicantInterviewers" 
                                                    runat="server" 
                                                    onselecting="InterviewerEditDataSource_Selecting" />

Open in new window

0
Comment
Question by:Shepwedd
  • 4
  • 2
6 Comments
 
LVL 15

Expert Comment

by:jinal
ID: 24746683
Hello,

remove this  and try SelectedValue='<%# Bind("InterviewerID") %>'>
0
 

Author Comment

by:Shepwedd
ID: 24746716
jinal,

I have that already referenced in my attached code?

I'm not too sure what you want me to remove either.

Thanks.
0
 
LVL 15

Expert Comment

by:jinal
ID: 24746766
<asp:DropDownList
                                                    ID="InterviewerEditDDL"
                                                    runat="server"
                                                    DataSourceID="InterviewerEditDataSource"
                                                    DataTextField="InterviewerName"
                                                    DataValueField="InterviewerID"
                                                    CssClass="ddlTxtBoxInterviewer"                                                    
                                                </asp:DropDownList>
                                                <asp:LinqDataSource
                                                    ID="InterviewerEditDataSource"
                                                    ContextTypeName="HRsystemDataContext"
                                                    TableName="ApplicantInterviewers"
                                                    runat="server"
                                                    onselecting="InterviewerEditDataSource_Selecting" />


0
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 

Author Comment

by:Shepwedd
ID: 24746865
jinal,

I have tried that but it flags the error: "Object reference not set to an istance of an object". I have also tried to set the selectedvalue (code attached) within the onitemupdating event of my listview (my drop down list control is within the edititemtemplate of a listview control) but again I get the above error?
protected void lvInterviewers_ItemUpdating(object sender, ListViewUpdateEventArgs e)
    {
        DropDownList ddlEditInterviewerID = (DropDownList)lvInterviewers.Items[e.ItemIndex].FindControl("InterviewerEditDDL");
        e.NewValues["InterviewerID"] = ddlEditInterviewerID.SelectedValue;
    }

Open in new window

0
 
LVL 15

Expert Comment

by:jinal
ID: 24747094
I think that is problem related to LinqDataSource.
0
 
LVL 15

Accepted Solution

by:
jinal earned 500 total points
ID: 24749124
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question