This error happens when I use the SelectedItem.Text
of a dropdownlist as a value to pass for ObjectDataSource.
Here is the markup
<asp:ObjectDataSource ID="odsInsert" runat="server" SelectMethod="GetStudentInClass2" TypeName="MIHE_MIS.DALS.MidTermExamResultDAL">
<SelectParameters>
<asp:ControlParameter DefaultValue="" ControlID="ddlClasses" Name="classCode" PropertyName="SelectedItem.Text" Type="String" />
<asp:ControlParameter ControlID="ddlSemesters" Name="semesterID" PropertyName="SelectedValue" Type="Int32" />
<asp:ControlParameter ControlID="ddlSpecialization" Name="specializationID" PropertyName="SelectedValue" Type="Int32" />
</SelectParameters>
</asp:ObjectDataSource>
Moreover, I add the Select Class
text the dropdownlist dynamically.
protected void ddlClasses_DataBound(object sender, EventArgs e)
{
ListItem list = new ListItem("Select Class", "-1");
this.ddlClasses.Items.Insert(0, list);
}