Last post Oct 12, 2012 03:37 PM by BigBen0
Oct 09, 2012 03:28 PM|BigBen0|LINK
A GridView displays the content of a table stored in an Access database.
Documents can be edited with a FormView when Edit button is pressed.
A field (many in the future) in this FormView should be choosen between entries from a second table.
If tried this :
- create a new AccessDataSource pointing to this second table
- add a dropdown list pointing using the new AccessDataSource.
=> Got a runtime error : No value given for one or more required parameters
I do not have any idea about this error as no text in the error message is refering to any known component.
So my question : could this be achieved ? If yes, what am I missing ?
Thanks a lot for any suggestion.
Oct 09, 2012 04:52 PM|emonti|LINK
make sure the datatextfield and datavaluefield is set on dropdownlist
also set SelectedValue to select their current choice like so
Oct 10, 2012 02:15 PM|BigBen0|LINK
Not sure to understand what has to be done.
Here is the error:
Line 172: <asp:DropDownList ID="DropDownList1" runat="server"
Line 173: DataSourceID="AccessDataSource3" DataTextField="Libelle"
Line 174: DataValueField="Libelle" SelectedValue='<%# Bind("Libelle") %>'>
HttpException (0x80004005): DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'Libelle'.]
Under DropDownList Tasks
Under Configure Data Source:
Datafield to display : "Libelle" (field I want to display a list)
Datafield for the value : "LIbelle"
Under Edit Data Bindings:
SelectedValue = Bind("Libelle")
Should these 3 values refer to different objects ?
Thanks a lot !
Oct 10, 2012 02:44 PM|emonti|LINK
the error is stating that field is not in your query result - does not contain a property with the name 'Libelle'
what does the datasource and query look like?
Oct 10, 2012 03:09 PM|BigBen0|LINK
Datasource : Database4.accdb ---it's an Access db
SELECT * FROM [OperationType] ORDER BY [Libelle] --- "OperationType" is the table from which I want to present a list in which user will choose a value to fill in another field (in this context also named "OperationType" in the table "Mvt"
I left the SelectedValue property empty and buid the project.
No more runtime error and the list displayed in the DropDownList control is correct.
My understanding of th problem is growing, but I still miss two important things.
Am I right ?
Thanks for your help.
Oct 10, 2012 04:20 PM|emonti|LINK
you will need to put the SelectedValue back in to do the update
it will crash if the value cannot match one from the lookup table OperationType
AppendDataBoundItems = true; will let you set up one empty record with a default value of empty string then if your record is blank it will match up to the default record like
Oct 12, 2012 03:37 PM|BigBen0|LINK
Ok: got it for "Choose libelle" entry.
But I am still missing how I have to set the dropdownlist to present the current field content as default.
Maybe it is not possible ?
Do I have to display the field (coming from MVT table) and to present the dropdownlist (populated with table OPERATIONTYPE) as an additionnal field used to choose a new value from ?