|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
IConvertible ErrorI've got two dropdowns which are unbound and which I bind the values of when
I update or insert. My method works on all of my other pages, but for some reason is not working on this page. When I try to update the record (it's in a formview), I get an IE message saying "Object must implement IConvertible." I have the following code in the formview_ItemUpdating event: ****************************** Dim strCompanyName As String = CType(FormView1.Row.FindControl("dropdownlist1"), DropDownList).SelectedValue Dim strCN As DropDownList = CType(FormView1.Row.FindControl("DropDownList2"), DropDownList) e.NewValues("CompanyName") = strCompanyName e.NewValues("ComponentNumber") = strCN ****************** Can anyone help me with this? > I have the following code in the formview_ItemUpdating event: What type is the ComponentNumber column? You cannot assign DropDownList > ****************************** > Dim strCompanyName As String = > CType(FormView1.Row.FindControl("dropdownlist1"), > DropDownList).SelectedValue > Dim strCN As DropDownList = > CType(FormView1.Row.FindControl("DropDownList2"), DropDownList) > > e.NewValues("CompanyName") = strCompanyName > e.NewValues("ComponentNumber") = strCN > ****************** there, use its SelectedValue instead, like in the first case... Robert Haken [MVP ASP/ASP.NET] HAVIT, s.r.o., www.havit.cz http://knowledge-base.havit.cz Thank you so much! What a stupid error!
Show quoteHide quote "Robert Haken [MVP]" wrote: > > I have the following code in the formview_ItemUpdating event: > > ****************************** > > Dim strCompanyName As String = > > CType(FormView1.Row.FindControl("dropdownlist1"), > > DropDownList).SelectedValue > > Dim strCN As DropDownList = > > CType(FormView1.Row.FindControl("DropDownList2"), DropDownList) > > > > e.NewValues("CompanyName") = strCompanyName > > e.NewValues("ComponentNumber") = strCN > > ****************** > > What type is the ComponentNumber column? You cannot assign DropDownList > there, use its SelectedValue instead, like in the first case... > > Robert Haken [MVP ASP/ASP.NET] > HAVIT, s.r.o., www.havit.cz > http://knowledge-base.havit.cz > > >
Design View when using an ASP:Panel to show/hide groups of <tr>'s
DropDownlist in EditItemTemplate Gridview Problem DropDownList question TabStrip change by javascript Failed to load viewstate. Javascript changes not saved IE-7 Where the webforms forums? Are there any updates released for IE7? WebControl, ClientCallback and Viewstate... Help Please!! |
|||||||||||||||||||||||