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 !