Infragistics4.Web.v14.1, Version=14.1.20141.2150
IE11
Windows 7
.NET 4.0
I have a WebDropDown on a RowEditingTemplate in a WebDataGrid. I need to display the Description of the WDD and save the Value. The WDD is loaded with the following:
Value Description
1 MORT LIFE
50 PROTECTION
99 MORT INSURANCE
I want MORT LIFE to display in the grid and 1 to be saved in the database. I have created a project to show what I am doing. Click on the Queues tab, select the Add button, select MORT LIFE in the WDD and select the OK button in the template. Then select the Save button at the bottom. Both the Text and Value contain MORT LIFE.
Can you assist me?
I also have the same problem on the client side. These two lines of code return the same. What am I doing wrong?
value = row.get_cellByColumnKey('EscrowType').get_value();
text = row.get_cellByColumnKey('EscrowType').get_text();
Hello Autumn,
Thank you for contacting Infragistics!
We received your support request concerning having a DropDownProvdier with a text and value that are different, and this case has been assigned to me. I have done an initial review of your case and you can achieve this by setting the TextField and ValueField. You will want to make sure that they are different. How are you currently setting these fields? I assume the underlying value of the column you are having the DropDownProvdier to in an int? How is the datasource of the grid setup?
Looking forward to hearing from you,
Can you open my attachment?
Thank you for the update. I believe you are seeing this behavior because the underlying value of your grid column that the DropDownProvider is assigned to is a string column that contains a text value. If you want it to be the int/number value that has to be the underlying value. I am attaching a sample that demonstrates this. Note I have deleted the ig_res folder to be able to attach to the forums.
Thanks for trying but I am using a RowEditingTemplate that contains a WDD. The Value in my example is int but not in my application.
Thank you for the update. I have done some further looking into your code and have found the following the reason you are getting a text value instead of interger is you call get_currentValue for the GetValueJavaScript method for the RowEditTemplate. This will give you the text that is in the input of the dropdown. Instead you want to do the following:
.GetValueJavaScript = "$find({ClientID}).get_selectedItem().get_value()"
I changed the following
.GetValueJavaScript = "$find({ClientID}).get_currentValue()"
to
Now the Value of the WDD displays in the grid. This is not correct. I need the Description to display in the grid. When I go to the server to save, I then need the Value.
The reason for this is that when you populate a value into a cell this way the editor provider doesn’t take effect until a postback occurs. You have a couple options: You could cause a postback manually so the text is updated based on the editor provider. The next would be to use RowEditing over RowEditTeample so you could edit a whole row at once if you want but the editors would be directly in the row instead of a separate dialog.
When the OK button is selected and the template closes, the grid is making an AJAX post-back. The wdgEscrow RowUpdating or RowAdding events are executed along with the wdgEscrow_PreRender. Can you see my attached project? Then another post-back occurs when the Save button is selected.
I do not know why this should be a problem. The template contains a WebDropDown, it transfers its Value and Text to the grid's DropDownProvider. When saving the data both the Value and Text should be available. But at this point they both contain the same values (Text3). The value (Value3) has been overlaid by the text.
Thank you for the update. I have done some looking into your code and I notice a few things. First you don’t seem to binding any data to the dropdownprovider for the editor providers collection. Next I see that you have EnableDataViewState set to true. Since you are preforming edits you is recommended you have this set to false. And instead you should set the datasource of the grid and of the dropdownprovider on every postback. This will maintain the data in the grid and the dropdown. So part of the reason you can’t see the proper values/text is your datasource for the DropDownProvider isn’t being set.