I am trying to get the ValueField (ID) from a DropDownProvider embedded in a column in a webdatagrid when its updated. So basically after the grid loads the user would update a column that has the drop down and hit a save button. When they hit save the RowUpdating event will fire and this is where I would like to update the DB. In the RowUpdating function i can get the TextField value with the following code: Var StatusDesc = e.Values["PI_WORKFLOW_STATUS_LOOKUP_DESC"];. But I cannot figure out how to get the updated ValueField which contains the primary key i need to use in my save. Here is my code.
Front END:
<ig:WebDataGrid ID="grdQueryMainDisplay" runat="server" Width="1200px" AutoGenerateColumns="False" DataKeyFields="PI_LOAD_MASTER_ID" OnRowUpdating="grdQueryMainDisplay_RowUpdating1" OnRowUpdated="grdQueryMainDisplay_RowUpdated" EnableAjax="True" EnableAjaxViewState="True">
<EditorProviders>
<ig:DropDownProvider ID="Statuses" EditorControl-DropDownContainerWidth="100px" EditorControl-DropDownContainerHeight="100px">
<EditorControl ID="EditorControl2" runat="server" DisplayMode="DropDownList" DataSourceID="dsGetStatusTypes" TextField="PI_WORKFLOW_STATUS_LOOKUP_DESC" ValueField="PI_WORKFLOW_STATUS_LOOKUP_ID" AutoPostBack="False" >
<DropDownItemBinding TextField="PI_WORKFLOW_STATUS_LOOKUP_DESC" ValueField="PI_WORKFLOW_STATUS_LOOKUP_ID"></DropDownItemBinding> </EditorControl>
</ig:DropDownProvider>
</EditorProviders>
<Columns>
<ig:BoundDataField DataFieldName="PI_SUB_CLIENT_NAME" Key="PI_SUB_CLIENT_NAME"> <Header Text="Client"> </Header> </ig:BoundDataField>
<ig:BoundDataField DataFieldName="PI_QUERY_NAME" Key="PI_QUERY_NAME"> <Header Text="Query"> </Header> </ig:BoundDataField>
<ig:BoundDataField DataFieldName="LOAD_END_DT" Key="LOAD_END_DT"> <Header Text="Query End Date"> </Header> </ig:BoundDataField> <ig:BoundDataField DataFieldName="PI_WORKFLOW_STATUS_LOOKUP_DESC" Key="PI_WORKFLOW_STATUS_LOOKUP_ID"> <Header Text="Status"> </Header>
</ig:BoundDataField>
Back END:
protected void grdQueryMainDisplay_RowUpdating1(object sender, Infragistics.Web.UI.GridControls.RowUpdatingEventArgs e) {
if (Request.Cookies["PageChanging"] != null) {
}
//This Line gives me the updated TextField
var StatusDesc = e.Values["PI_WORKFLOW_STATUS_LOOKUP_DESC"];
//need to get the updated key value here. The ValueField from the DropDownProvider
Hello Jim ,
Thank you for posting in our forum.
In general the value of the drop down editor should be what’s passed in the Updating event’s event arguments.
As long as the data types of the column of the grid is the same as the value field used for the editor you should get the value on the server side, not the text.
I’ve tested this on my side in a similar scenario with version 14.1 and the value of the WebDropDown provider was properly passed and retrieved in the RowUpdating event.
I’ve attached the sample for your reference. Please test it on your side and let me know if you’re encountering any issues with it.
If you’re using a different version or if the sample is not an accurate demonstration of the exact scenario please feel free to modify the sample and send it back or attach a sample of your own, if you have one.
Best Regards,
Maya Kirova
Developer Support Engineer II
Infragistics, Inc.
http://www.infragistics.com/support
Thanks for replying and taking time to help. I'm using ver13.1. I have attached a sample of my code. I used an SQLDatasource to pull the values for the Editor drop down but there are only 4 records and they would look like this if you wanted to mock them up. Description column = PI_WORKFLOW_STATUS_LOOKUP_DESC with the following values (New, In Progress, Complete, Cancelled). The Description ID column = PI_WORKFLOW_STATUS_LOOKUP_ID and would simply be (1,2,3,4). In my case the datatype of the PI_WORKFLOW_STATUS_LOOKUP_ID is an int in the database. So, and you can see in my example, I converted the PI_WORKFLOW_STATUS_LOOKUP_ID to varchar to make sure all the datatypes were the same. But I still get the textfield and not the valuefield when I have the following code in my RowUpdating event: string StatusDesc = e.Values["PI_WORKFLOW_STATUS_LOOKUP_DESC"].
Hello Jim,
Your development issue has been addressed in our latest service release which is available for download.
Please let me know if you come across any further issues with the new service release or if you have any further questions .
Regards,
Tsanna