Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 230253
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T19:50:02+00:00 2026-05-11T19:50:02+00:00

I have the below error message in my asp.net website when i replaced the

  • 0

I have the below error message in my asp.net website when i replaced the textbox and put dropdown and named the dropdown id same as textbox id.

The value from the drop down should be taken and put in a email body and will be received as mail when i click on the submit button.

Below is the error i am getting when i click on the submit button.

System.InvalidCastException: Unable to cast object of type ‘System.Web.UI.WebControls.DropDownList’ to type ‘System.Web.UI.WebControls.TextBox’. at WebApplication1._Default.collectEmailBodyText() in C:\v1.5_production_05June09\Default.aspx.vb:line 213

My code behind file is as follows :

''//------------------------------------------------------------------------------
''// <auto-generated>
''//     This code was generated by a tool.
''//     Runtime Version:2.0.50727.3053
''//
''//     Changes to this file may cause incorrect behavior and will be lost if
''//     the code is regenerated.
''// </auto-generated>
''//------------------------------------------------------------------------------

Option Strict On
Option Explicit On

Partial Public Class _Default

    Protected WithEvents form1 As Global.System.Web.UI.HtmlControls.HtmlForm

    Protected WithEvents MultiView1 As Global.System.Web.UI.WebControls.MultiView

    Protected WithEvents View0 As Global.System.Web.UI.WebControls.View

    Protected WithEvents lbl_viewTitle0 As Global.System.Web.UI.WebControls.Label

    Protected WithEvents lbl_view0_firstName As Global.System.Web.UI.WebControls.Label

    Protected WithEvents txt_firstName As Global.System.Web.UI.WebControls.TextBox

    Protected WithEvents Validator_FirstName As Global.System.Web.UI.WebControls.RequiredFieldValidator

    Protected WithEvents lbl_view0_surname As Global.System.Web.UI.WebControls.Label

    Protected WithEvents txtSurName As Global.System.Web.UI.WebControls.TextBox    

    Protected WithEvents Validator_Surname As Global.System.Web.UI.WebControls.RequiredFieldValidator

    Protected WithEvents lbl_view0_ContactNum As Global.System.Web.UI.WebControls.Label

    Protected WithEvents txt_contactNum As Global.System.Web.UI.WebControls.TextBox

    Protected WithEvents Validator_ContactNumber As Global.System.Web.UI.WebControls.RequiredFieldValidator

    Protected WithEvents lbl_view0_typeOfRequest As Global.System.Web.UI.WebControls.Label

    Protected WithEvents ddl_view0_typeOfRequest As Global.System.Web.UI.WebControls.DropDownList

    Protected WithEvents lbl_view0_workUnitLevel As Global.System.Web.UI.WebControls.Label

    Protected WithEvents ddl_view0_workUnitLevel As Global.System.Web.UI.WebControls.DropDownList

    Protected WithEvents btn_view0_forward As Global.System.Web.UI.WebControls.Button

    Protected WithEvents View1 As Global.System.Web.UI.WebControls.View

    Protected WithEvents lbl_viewTitle1 As Global.System.Web.UI.WebControls.Label  

    Protected WithEvents lbl_view1_firstName As Global.System.Web.UI.WebControls.Label

    Protected WithEvents txt_view1_firstname As Global.System.Web.UI.WebControls.TextBox

    Protected WithEvents lbl_view1_surname As Global.System.Web.UI.WebControls.Label

    Protected WithEvents txt_view1_surname As Global.System.Web.UI.WebControls.TextBox

    Protected WithEvents lbl_view1_userID As Global.System.Web.UI.WebControls.Label

    Protected WithEvents txt_view1_userID As Global.System.Web.UI.WebControls.TextBox

    Protected WithEvents lbl_view1_workUnit As Global.System.Web.UI.WebControls.Label

    Protected WithEvents ddl_view1_workunit As Global.System.Web.UI.WebControls.DropDownList

    Protected WithEvents panview0 As Global.System.Web.UI.WebControls.Panel

    Protected WithEvents lbl_panView0_label1 As Global.System.Web.UI.WebControls.Label

    Protected WithEvents txt_panview0_input1 As Global.System.Web.UI.WebControls.TextBox

    Protected WithEvents panview2 As Global.System.Web.UI.WebControls.Panel

    Protected WithEvents lbl_panview2_label1 As Global.System.Web.UI.WebControls.Label

    Protected WithEvents txt_panview2_input1 As Global.System.Web.UI.WebControls.TextBox

    Protected WithEvents panview1 As Global.System.Web.UI.WebControls.Panel

    Protected WithEvents lbl_panview1_label1 As Global.System.Web.UI.WebControls.Label

    Protected WithEvents txt_panview1_input1 As Global.System.Web.UI.WebControls.TextBox   

    Protected WithEvents panview3 As Global.System.Web.UI.WebControls.Panel

    Protected WithEvents lbl_panview3_label1 As Global.System.Web.UI.WebControls.Label

    Protected WithEvents txt_panview3_input1 As Global.System.Web.UI.WebControls.DropDownList

    Protected WithEvents lbl_panview3_label2 As Global.System.Web.UI.WebControls.Label

    Protected WithEvents txt_panview3_input2 As Global.System.Web.UI.WebControls.TextBox

    Protected WithEvents btn_view1_back As Global.System.Web.UI.WebControls.Button

    Protected WithEvents btn_view1_forward As Global.System.Web.UI.WebControls.Button

    Protected WithEvents View2 As Global.System.Web.UI.WebControls.View

    Protected WithEvents lbl_viewTitle2 As Global.System.Web.UI.WebControls.Label

    Protected WithEvents lbl_view2_ManagersEmailAddress As Global.System.Web.UI.WebControls.Label

    Protected WithEvents txt_view2_ManagersEmailAddress As Global.System.Web.UI.WebControls.TextBox

    Protected WithEvents rfv_view2_managersEmail As Global.System.Web.UI.WebControls.RequiredFieldValidator

    Protected WithEvents rev_view2_managersEmail As Global.System.Web.UI.WebControls.RegularExpressionValidator

    Protected WithEvents btn_view2_back As Global.System.Web.UI.WebControls.Button  

    Protected WithEvents btn_view02_forward As Global.System.Web.UI.WebControls.Button

    Protected WithEvents View3 As Global.System.Web.UI.WebControls.View

    Protected WithEvents lbl_viewTitle3 As Global.System.Web.UI.WebControls.Label

    Protected WithEvents lit_preview As Global.System.Web.UI.WebControls.Literal

    Protected WithEvents btn_view3_submit As Global.System.Web.UI.WebControls.Button

    Protected WithEvents btn_view3_back As Global.System.Web.UI.WebControls.Button
End Class

Please help me !

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T19:50:02+00:00Added an answer on May 11, 2026 at 7:50 pm

    In your code behind, it looks like in your FindControls you’re trying to handle a DropDownList as a TextBox. You should verify that the object definitions in your .aspx and code behind correspond in their declarations and in FindControls.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 263k
  • Answers 263k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Using local references is common, especially inside loop bodies, but… May 13, 2026 at 12:02 pm
  • Editorial Team
    Editorial Team added an answer You could just create a file called d.aspx in your… May 13, 2026 at 12:02 pm
  • Editorial Team
    Editorial Team added an answer Look at ALL_TAB_PRIVS: select grantee from all_tab_privs where table_schema =… May 13, 2026 at 12:02 pm

Related Questions

It has been two days and I haven't been able to make this application
I have the following code in my Site.Master page of an almost empty ASP.NET
I have installed .NET Framework 3.5 SP1 and ASP.NET MVC CTP in a Windows

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.