ID is a field that needs user's input.
Thanks so much, Superguppie !! e.value works brilliantly. My biggest problem has been solved.
About the dropdownlist problem, I keep getting the following error msg
'DropDownListTerm' has a SelectedValue which is invalid because it does not exist in the list of items. Parameter name: value
In fact, intellisense does not give me the property selectedvalue. I just hardcoded it in.
<asp:DropDownList ID="DropDownListTerm" runat="server" selectedvalue= '<%# Eval("Term") %>' >
<asp:ListItem Value="Select">Select</asp:ListItem>
<asp:ListItem Value="Fall">Fall</asp:ListItem>
<asp:ListItem Value="Winter">Winter</asp:ListItem>
<asp:ListItem Value="Spring">Spring</asp:ListItem>
<asp:ListItem Value="Summer">Summer</asp:ListItem>
</asp:DropDownList>
UpdateCommand="UPDATE [StudentCourse] SET [CourseID] = @CourseID, [Term] = @Term, [Year] = @Year, [Grade] = @Grade WHERE [StudentID] = @StudentID">
<UpdateParameters>
<asp:Parameter Name="CourseID" Type="String" />
<asp:Parameter Name="Term" Type="String" />
<asp:Parameter Name="Year" Type="String" />
<asp:Parameter Name="Grade" Type="String" />
<asp:Parameter Name="Elective" Type="String" />
<asp:Parameter Name="StudentID" Type="String" />
Then, I try to add the selected value of the dropdownlist to the database in asp.vb by getting value from dropdown list using
Term.Text =CType(FormView2.FindControl("Term"), DropDownList).SelectedItem.Value
But, it also gives me error msg about instances .
I have seen quite a few example and reading some books and still have no clue.
Can you help me with this as well?
All I want is to use a dropdownlist in a formview. It should be very straight forward. I am very surprise Visual Web Developer doesn't handle it automatically.
Gratefully,
Aaron