Hi, I try to implement very nice example with editing grid on doubleclick, but have some problem.
Look at the example: http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/editondblclick/defaultcs.aspx
There is a column "In stock". During editing the values are loaded from DataSource1. Is it possible to load the date from different DataSource (not the same as RadGrid). As I saw somewher there is no DataSource proprties on GridDropDownListColumnEditor...
Look at the example: http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/editondblclick/defaultcs.aspx
There is a column "In stock". During editing the values are loaded from DataSource1. Is it possible to load the date from different DataSource (not the same as RadGrid). As I saw somewher there is no DataSource proprties on GridDropDownListColumnEditor...
5 Answers, 1 is accepted
0
Princy
Top achievements
Rank 2
answered on 08 Nov 2010, 07:14 AM
Hello ,
The following code snippet shows how to set different DataSourceID to GridDropDownColumn.
ASPX:
C#:
You can refer the following documentation for more information on customizing GridDropDownColumn
Customize/Configure GridDropDownColumn.
Thanks,
Princy.
The following code snippet shows how to set different DataSourceID to GridDropDownColumn.
ASPX:
<
telerik:GridDropDownColumn
HeaderText
=
"Editable1"
ListValueField
=
"TerritoryID"
UniqueName
=
"DropdownColumn"
ListTextField
=
"TerritoryID"
DropDownControlType
=
"RadComboBox"
>
</
telerik:GridDropDownColumn
>
C#:
protected
void
RadGrid1_ItemDataBound(
object
sender, GridItemEventArgs e)
{
if
(e.Item
is
GridEditableItem && e.Item.IsInEditMode)
{
GridEditableItem edititem = (GridEditableItem)e.Item;
GridEditManager editMan = edititem.EditManager;
GridDropDownListColumnEditor editor = (GridDropDownListColumnEditor)(editMan.GetColumnEditor(
"DropdownColumn"
));
RadComboBox rComboBox = editor.ComboBoxControl;
rComboBox.DataSourceID = "SqlDataSource2";
//Setting the new DataSourceID.
rComboBox.DataTextField =
"TerritoryID
"
;
rComboBox.DataValueField =
"TerritoryID
"
;
rComboBox.DataBind();
}
}
You can refer the following documentation for more information on customizing GridDropDownColumn
Customize/Configure GridDropDownColumn.
Thanks,
Princy.
0
ToMa
Top achievements
Rank 1
answered on 08 Nov 2010, 10:57 AM
Thanks Princy,
so in this case the source data which may be changed comes from DataSource1 and possible new list data comes from DataSource2?
Original value should be shown by
so in this case the source data which may be changed comes from DataSource1 and possible new list data comes from DataSource2?
Original value should be shown by
GridDropDownColumn
and after double click list data from DataSource2 should be shown..0
Hello ToMa,
Indeed, on ItemDataBound event you can change the editable fields just as desired and as Princy showed. Can you elaborate what issues you are facing implementing this approach in your case?
Sincerely yours,
Iana
the Telerik team
Indeed, on ItemDataBound event you can change the editable fields just as desired and as Princy showed. Can you elaborate what issues you are facing implementing this approach in your case?
Sincerely yours,
Iana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
ToMa
Top achievements
Rank 1
answered on 10 Nov 2010, 10:02 PM
I am not sure I understand it correctly. Lets say I have a table with records which may be edited. Let it be Persons table and one of column is city of birth - there is an example. In City column there is only ID of city which is related with City table.
My goal is to show City name which can be updated. On double click I want to show ComboBox with all cities from City table. In you example - In stock column ComboBox shows possibilites from the same Select statement.
Your example:
and then:
When I change
How to show the original value before double clicked?
My goal is to show City name which can be updated. On double click I want to show ComboBox with all cities from City table. In you example - In stock column ComboBox shows possibilites from the same Select statement.
Your example:
<telerik:GridDropDownColumn UniqueName=
"UnitsInStock"
HeaderText=
"In stock"
ColumnEditorID=
"GridDropDownListColumnEditor1"
ListTextField=
"UnitsInStock"
ListValueField=
"UnitsInStock"
DataSourceID=
"SessionDataSource1"
DataField=
"UnitsInStock"
HeaderStyle-Width=
"10%"
/>
and then:
<telerik:GridDropDownListColumnEditor ID=
"GridDropDownListColumnEditor1"
runat=
"server"
DropDownStyle-Width=
"70px"
/>
When I change
ListTextField
, ListValueField
and DataSourceID
with values from DataSource2 and leave DataField
with value from DataSource1 I got nothing, but when I double click I got combobox with list from DataSource2.How to show the original value before double clicked?
0
ToMa
Top achievements
Rank 1
answered on 10 Nov 2010, 10:27 PM
OK. It solved and it works of course. Problem was with DataField/ListValueField :
According to documentation:
Ensure that the fields specified through the DataField/ListValueField properties are of the same data type and the entries have a precise match, otherwise you will get merely the first item from the list displayed in non-editable mode. This can also happen if you have not configured properly the GridDropDownColumn, e.g. the relations between the fields specified through the DataField/ListValueField properties.
I my case DataField and ListValueField couldn't relate each other.
Thanks for your help.
According to documentation:
Ensure that the fields specified through the DataField/ListValueField properties are of the same data type and the entries have a precise match, otherwise you will get merely the first item from the list displayed in non-editable mode. This can also happen if you have not configured properly the GridDropDownColumn, e.g. the relations between the fields specified through the DataField/ListValueField properties.
I my case DataField and ListValueField couldn't relate each other.
Thanks for your help.