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
294 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
[X]
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
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
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…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

726 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