<
telerik:RadGrid
runat
=
"server"
ID
=
"gvTable"
AllowPaging
=
"True"
Skin
=
"Vista"
PageSize
=
"100"
AllowSorting
=
"True"
ClientSettings-DataBinding-EnableCaching
=
"true"
GridLines
=
"None"
AutoGenerateEditColumn
=
"True"
AutoGenerateDeleteColumn
=
"True"
AllowAutomaticUpdates
=
"False"
OnUpdateCommand
=
"gvTable_UpdateCommand"
OnInsertCommand
=
"gvTable_InsertCommand"
AllowAutomaticDeletes
=
"True"
AllowAutomaticInserts
=
"True"
onneeddatasource
=
"gvTable_NeedDataSource"
>
<
ExportSettings
FileName
=
"Order Details"
IgnorePaging
=
"True"
ExportOnlyData
=
"true"
>
</
ExportSettings
>
<
ClientSettings
EnableRowHoverStyle
=
"True"
Selecting-AllowRowSelect
=
"true"
>
<
DataBinding
EnableCaching
=
"True"
>
</
DataBinding
>
<
Selecting
AllowRowSelect
=
"True"
></
Selecting
>
</
ClientSettings
>
<
MasterTableView
InsertItemPageIndexAction
=
"ShowItemOnCurrentPage"
EnableHeaderContextMenu
=
"True"
CommandItemDisplay
=
"Top"
EditMode
=
"InPlace"
DataKeyNames
=
""
>
<
CommandItemSettings
ShowExportToExcelButton
=
"true"
AddNewRecordText
=
""
ShowAddNewRecordButton
=
"False"
/>
<
Columns
>
</
Columns
>
<
HeaderStyle
Font-Bold
=
"False"
/>
</
MasterTableView
>
<
PagerStyle
Mode
=
"NextPrevAndNumeric"
/>
</
telerik:RadGrid
>
protected void gvTable_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
DataTable dt = this.GridSource;
this.gvTable.DataSource = dt;
this.gvTable.MasterTableView.DataKeyNames = GetColNames(dt);
}
protected void gvTable_UpdateCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
{
GridEditableItem editedItem = e.Item as GridEditableItem;
DataTable ordersTable = this.GridSource;
//Locate the changed row in the DataSource
DataRow[] changedRows = ordersTable.Select("col1 = " + editedItem.OwnerTableView.DataKeyValues[editedItem.ItemIndex]["col1"].ToString());
//editedItem["Item"].Controls[0]
if (changedRows.Length != 1)
{
this.Label1.Text += "Unable to locate the Order for updating.";
e.Canceled = true;
return;
}
//Update new values
Hashtable newValues = new Hashtable();
e.Item.OwnerTableView.ExtractValuesFromItem(newValues, editedItem);
changedRows[0].BeginEdit();
try
{
foreach (DictionaryEntry entry in newValues)
{
changedRows[0][(string)entry.Key] = entry.Value;
}
changedRows[0].EndEdit();
Label1.Text = "Successfully updated";
}
catch (Exception ex)
{
changedRows[0].CancelEdit();
Label1.Text += "Unable to update Orders. Reason: " + ex.Message;
e.Canceled = true;
}
}
Hi All,
I'm using Telerik Grid and binded an XML through dataset. I've a autyo generate edit coulmn.
When I press edit, I get a text box with exisitng value and update, cancel button. After typing new value whren i press am not getting the new value in the grid. Can any one help on this. I'm using updatecommand event,but no use so far. Here is my code
Hashtable newValues = new Hashtable();
((GridEditableItem)e.Item).ExtractValues(newValues);
GridEditableItem editItem = (GridEditableItem)e.Item;
GridEditableItem editedItem = e.Item as GridEditableItem;
GridEditManager editMan = editedItem.EditManager;
var obj = editItem.GetDataKeyValue("ConnectionString");
//TextBox txt = e.Item.FindControl("txtValue") as TextBox;
//if (txt != null)
//{
// string s = txt.Text;
//}
ds.Tables["add"].Rows[editItem.DataSetIndex][1] = "XXXXX";
//radDisplay.DataSource = ds.Tables["add"];
radDisplay.Rebind();
StringWriter sw = new StringWriter();
ds.WriteXml(sw);
Session["decryptesXMLString"] = sw.ToString();
.RadComboBoxDropDown ul li, .rtsLI, .reEditorModes li, .rtLI, .rmItem, .rwControlButtons li
{
background-image: none;
}
.RadWindow TD
{
border: 0;
padding:0;
}
But this is a nuisance to have to add these fixes everytime I notice an issue. I would expect that all RAD controls would override all CSS values and I think this should be fixed.