Hello Telerik Team,
So, I'm implementing the new "Client edit with batch server update" (on the DEMO) (the version i'm using is "2010.1.309.35"). The thing is I'm using a RadGrid with nested view tables (juste one by item in the master table) and the edition is taking place only on the detail tables.
So the matter is I can't get the new information two storage it on BDD because I can't get the control (neither TextBox nor RadDatePicker or whathever control be).
I try this :
the markup
the server side code:
So, how can I proceed to find the controls and get the edited information?
Best wishes,
Santiago
So, I'm implementing the new "Client edit with batch server update" (on the DEMO) (the version i'm using is "2010.1.309.35"). The thing is I'm using a RadGrid with nested view tables (juste one by item in the master table) and the edition is taking place only on the detail tables.
So the matter is I can't get the new information two storage it on BDD because I can't get the control (neither TextBox nor RadDatePicker or whathever control be).
I try this :
the markup
<div id="divRadGridVehicles" class="MaintenanceGrid"> |
<telerik:RadGrid ID="RadGrid_Vehicles" runat="server" |
AllowPaging="True" |
oncolumncreated="RadGrid_Vehicles_ColumnCreated" |
onneeddatasource="RadGrid_Vehicles_NeedDataSource" |
ondetailtabledatabind="RadGrid_Vehicles_DetailTableDataBind" |
onitemcreated="RadGrid_Vehicles_ItemCreated" |
onitemdatabound="RadGrid_Vehicles_ItemDataBound" > |
<HeaderStyle Width="70px" HorizontalAlign="Center" Font-Bold="true" BorderWidth="1px" BorderColor="White"/> |
<ItemStyle HorizontalAlign="Center" /> |
<AlternatingItemStyle HorizontalAlign="Center" /> |
<MasterTableView EditMode="InPlace" |
CommandItemDisplay="Bottom" TableLayout="Fixed"> |
<NoRecordsTemplate> |
<div style="height: 30px; cursor: pointer;"> |
No items to view</div> |
</NoRecordsTemplate> |
<CommandItemTemplate> |
<div style="height: 30px; text-align: right;"> |
<asp:Image ID="imgCancelChanges" |
runat="server" |
ImageUrl="~/App_Themes/Client/Images/Maintenance/cancel.gif" |
AlternateText="Cancel changes" |
ToolTip="Cancel changes" |
Height="24px" |
style="cursor: pointer; margin: 2px 5px 0px 0px;" onclick="CancelChanges();" /> |
<asp:Image ID="imgProcessChanges" |
runat="server" |
ImageUrl="~/App_Themes/Client/Images/Maintenance/ok.gif" |
AlternateText="Process changes" |
ToolTip="Process changes" |
Height="24px" |
style="cursor: pointer; margin: 2px 5px 0px 0px;" onclick="ProcessChanges();" /> |
</div> |
</CommandItemTemplate> |
<DetailTables> |
<telerik:GridTableView EditMode="InPlace" ClientDataKeyNames="ID, HM_ID" DataKeyNames="ID, HM_ID" > |
</telerik:GridTableView> |
</DetailTables> |
</MasterTableView> |
<ClientSettings> |
<ClientEvents OnRowCreated="RowCreated" |
OnRowClick="RowClick" |
OnCommand="Grids_Command" |
OnGridDestroying="GridDestroying" |
OnRowDropping="onRowDropping" /> |
<Selecting AllowRowSelect="true" EnableDragToSelectRows="false" /> |
<Scrolling AllowScroll="True" /> |
</ClientSettings> |
</telerik:RadGrid> |
</div> |
the server side code:
protected void radAjax_AjaxRequest(object sender, AjaxRequestEventArgs e) |
{ |
//this doesn't work (return null)------------- |
//updatedItem = RadGrid_Vehicles.MasterTableView.DetailTables[Convert.ToInt32(hmId_detailTableIndex[1])].FindItemByKeyValue("HM_ID", int.Parse(hmId_detailTableIndex[0])); |
string keyValue = hmId_detailTableIndex[0]; |
//---------------------------------------------------- |
// this return the row but it is impossible to find the controls ------------ |
GridTableView nestedTableView = (RadGrid_Vehicles.MasterTableView.Items[0] as GridDataItem).ChildItem.NestedTableViews[0]; |
string keyValue = hmId_detailTableIndex[0]; |
rowItem = nestedTableView.FindItemByKeyValue("ID", (object)int.Parse(keyValue)); |
UpdateDetailVehicleValues(rowItem); |
} |
protected void UpdateDetailVehicleValues(GridDataItem updatedItem) |
{ |
TextBox txtBox = new TextBox(); |
RadDatePicker radDatePicker = new RadDatePicker(); |
//It doesn't find the control |
txtBox.Text = ((TextBox)updatedItem.FindControl("txtBox_HM_ID_" + (string)updatedItem["HM_ID"].Text)).Text; |
radDatePicker.SelectedDate = ((RadDatePicker)updatedItem[""].Controls[1]).SelectedDate; |
if (updatedItem["HM_ID"].Text != "") |
{ |
managerClient.managerMaintenance.UpdateHistoryMaintenance( |
Convert.ToInt32(updatedItem["HM_ID"].Text), |
txtBox.Text, |
Convert.ToDateTime(radDatePicker.SelectedDate)); |
} |
} |
So, how can I proceed to find the controls and get the edited information?
Best wishes,
Santiago