Hi,
I use the method ExtractValuesFromItem (newValue,editedItem)
(This method is great!)
I have a problem :
newValue.key.ToString() return the name of the datafield
but I need the name of the uniquename.
I have the datafield and the uniquename different.
can I have uniquname instead of DataField in the newValue ?
Or can I recover UniqueName from DataField?
Thaks
I use the method ExtractValuesFromItem (newValue,editedItem)
(This method is great!)
I have a problem :
newValue.key.ToString() return the name of the datafield
but I need the name of the uniquename.
I have the datafield and the uniquename different.
can I have uniquname instead of DataField in the newValue ?
Or can I recover UniqueName from DataField?
Thaks
4 Answers, 1 is accepted
0

Shinu
Top achievements
Rank 2
answered on 13 Dec 2011, 04:46 AM
Hello Lasly,
Check the following help documentation which explains retrieving values in update command.
Updating Values Using InPlace and EditForms Modes
-Shinu.
Check the following help documentation which explains retrieving values in update command.
Updating Values Using InPlace and EditForms Modes
-Shinu.
0

Lasly
Top achievements
Rank 1
answered on 13 Dec 2011, 09:55 AM
thanks for the reply.
but i have the same problem.
I try to explain the situation better:
I have this method in a class:
I'm using "insertedValues.key.tostring ()" as the name of the StoredProcedure parameters.
I'm using "insertedItem.GetDataKeyValue (dataKeyValue)" as the StoredProcedure parameters value .
I'm using "string [] dataKeyValues​​" to apply the same method to readonly columns .
(The readonly columns are not extracted from the "ExtractValuesFromItem")
The name of the StoredProcedure parameters , sometimes, is not called the same as the name of the DataField, but the name of the StoredProcedure Parameters is equal to Uniquename.
The ExtractValuesFromItem method fills the dictionary object with key / value pairs where key is the DataField Each of an edited field column and the Corresponding value is the new date Entered by the user
Can I have same function but with Uniquname instead of DataField?
(or maybe insertedItem.GetDataUniquname() instead of insertedItem.GetDataKeyValue() )
Thanks
but i have the same problem.
I try to explain the situation better:
I have this method in a class:
public
static
int
PopolaCommandInsertUpdate(GridCommandEventArgs e, StoredProcedure sp,
string
[] dataKeyValues)
{
if
((e.Item
is
GridEditableItem))
{
GridEditableItem insertedItem = (GridEditableItem)e.Item;
Hashtable insertedValues =
new
Hashtable();
e.Item.OwnerTableView.ExtractValuesFromItem(insertedValues, insertedItem);
foreach
(
string
dataKeyValue
in
dataKeyValues)
{
sp.Parameters[dataKeyValue].ParameterValue = insertedItem.GetDataKeyValue(dataKeyValue);
}
foreach
(DictionaryEntry entry
in
insertedValues)
{
if
(entry.Value !=
null
)
{
sp.Parameters[entry.Key.ToString()].ParameterValue = entry.Value;
}
}
}
return
sp.Execute<
int
>();
}
I'm using "insertedValues.key.tostring ()" as the name of the StoredProcedure parameters.
I'm using "insertedItem.GetDataKeyValue (dataKeyValue)" as the StoredProcedure parameters value .
I'm using "string [] dataKeyValues​​" to apply the same method to readonly columns .
(The readonly columns are not extracted from the "ExtractValuesFromItem")
The name of the StoredProcedure parameters , sometimes, is not called the same as the name of the DataField, but the name of the StoredProcedure Parameters is equal to Uniquename.
The ExtractValuesFromItem method fills the dictionary object with key / value pairs where key is the DataField Each of an edited field column and the Corresponding value is the new date Entered by the user
Can I have same function but with Uniquname instead of DataField?
(or maybe insertedItem.GetDataUniquname() instead of insertedItem.GetDataKeyValue() )
Thanks
0
Accepted
Hello Lasly,
Kind regards,
Marin
the Telerik team
Once you have the DataField of the columns you can iterate over them and get the corresponding UniqueName:
foreach
(GridColumn col
in
RadGrid1.Columns)
{
var boundCol = col
as
GridBoundColumn;
if
(boundCol !=
null
&& boundCol.DataField == insertedValues.key)
{
uniqueName = boundCol.UniqueName;
}
}
Marin
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0

Lasly
Top achievements
Rank 1
answered on 15 Dec 2011, 11:12 AM
Ok , thanks