DevExpress RowUpdating old values returning text value - asp.net

I have a DevExpress ASPXGridView which has been bound with a dataset.
I'm using the edit row command to edit the data in the row and return it to the database.
When the edit button is clicked, the row opens up and there is an ASPXComboBox that is bound to another dataset. The TextField and the ValueField have both been properly set in the ASPXComboBox and are displaying data correctly. The data is as shown
List item
List item
When e.NewValues("") is called the integer value field i.e 1 is returned. However, when e.OldValues("") the TextField is returned i.e. "List Item"
Is there a way of returning the the integer value when calling e.Oldvalues without having to make another call to the database?
Thanks

Related

ASPX FormView data not displayed with valid data from datasource

I have an aspx Formview set to 'Edit' mode and a valid SQL datasource that returns the correct data row based on the row ID. These lines in my grid rowcommand event:
DailyDataSource.SelectParameters["ID"].DefaultValue = recid.ToString();
FormView1.DataBind();
DataRowView drv = (DataRowView)FormView1.DataItem;
returns a valid DataRowView object with the correct data record. However, the DataBind() appears to not be working - no data appears in the entry text boxes. Unless I set the entry textboxes to 'ReadOnly'. They then display the returned data, but I (obviously) cannot edit it.
I can edit and enter data in the non-readonly text boxes, and the Save command saves the data, and it displays in the gridview, but if I try to edit it, I again get a valid set of data, but no displayed data.
My question: Why is making these fields readonly allowing the data to be displayed?
Second question: Why is the data in the datasource returned record not appearing in the editable textboxes?
BLUF: I needed to do the formview data load in the PostBack event, in order to get the correct session variables which were set by other events. Question of "How can I be so dumb when I am so smart?"

Java FX 8 Tablecell data to Listview selected data

I have a Java FX TableView with a column. This column is pre-populated with values from a database. When I click a cell on the table a listview is shown, I can update the table cell and the DB by selecting the values from the list.
Before the listview shows up, I set the selected value of the list to match the existing table cell's value by the following
listView.getSelectionModel().select(this.getItem());
when the list view opens the selected item corresponds to the cell value of the table.
I have a onchangelistener attached to the listview's selectedItemProperty.
From this list view if I choose a new value, When the selection changes the DB gets updated and the table cell gets updated with the new value.
If there is a problem with the database update, the listview's selected ItemProperty still retains the newly selected value.
I have tried resetting it using
listView.getSelectionModel().select(this.getItem());
but this doesn't reset the selectedItemProperty value.
Hence if you click the same cell once again, the list is having the previously selected value highlighted (i.e the value which was not updated due to a DB failure) the table cell and the selected value in the listview are different.
How do I overcome this ?

Set default value of dropdownlist based on datasource

I have a webform that uses a dropdownlist to populate a gridview. The dropdown list is bound to a datasource. I would like to have the default value of the dropdown list be a value in the listing. I have a series of 5 values, one of which is actually a blank. The default value I am looking for would be index 2 or the value "Agency Error"
Here is the query I have for the datasource:
SELECT DISTINCT [AnnoType] FROM [AnnoType]
Is there a way to do this?
I am just trying to eliminate one of maybe 50 clicks the user needs to do in the process.
Use SelectedIndex property
dropdownlist.SelectedIndex = 2;
or SelectedValue property
dropdownlist.SelectedValue = dropdownlist.Items.FindByText("Agency Error").Value;

How to make custom combobox inside ASPxGridView

Is it possible to have combobox with 2 valuefields, other words, if we are inserting some columns, this combobox should give value to 2 columns. Hope its undersentable.
Is it possible to have combobox like this inside ASPxGridView?
Use this procedure:
1. Submit one combo box value
2. In ASPxGridView.RowInserting event use that value (retrieve it from e.NewValues) to fetch others.
3. Insert fetched values into e.NewValues.
This will work if you can fetch all row values using combo box value.

RadioButton list in GridView - 2 way databinding possible?

If I have an ASP.Net RadioButtonList within a TemplateField in a GridView, which is tied to a Data Control, I can get databinding on page loading like so:
<asp:RadioButtonList SelectedValue='<%#Eval("RequirementOption")%>'>
So when the gridview renders, the user can select an option for each row in the grid.
What I'm wondering is, when the save button is pressed and a postback occurs, is there a way to automatically push these selected values back through to the datacontrol so they can be saved, or do I have to manually loop through all the grid rows and exract the chosen value, like so:
For iRow As Integer = 0 To Me.myGrid.Rows.Count - 1
Dim selectedValue As String = CType(Me.myGrid.Rows(iRow).FindControl("RequirementOption"), RadioButtonList).SelectedValue
'...Load up the appropriate class and save the selected value
Next
Can it be done automatically via databinding?
NOTE: I am talking about about updating all the rows and then accessing all of them opn postback, not one row at a time via inline editing.
Yes, the selectedValue will be available as long as you specify Bind instead of Eval.
(assuming you're updating a record in the usual way)

Resources