?
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
Medium Priority
?
298 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
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 

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 1500 total points
ID: 24749124
0

Featured Post

Industry Leaders: 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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Suggested Courses

777 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