This is a migrated thread and some comments may be shown as answers.

Telrik grid update event is not fire why what can i do

1 Answer 124 Views
Grid
This is a migrated thread and some comments may be shown as answers.
koteswararao
Top achievements
Rank 1
koteswararao asked on 23 Jan 2012, 01:13 PM
hi,

i am using the telerik rad grid my code is as follows please see the code . i am using the dataset with the relations for hierarchy  that code is like this  i am using vb.net and telerik q3 version when i click on the edit the row is in edit mode but when i click on the update it did not go to ItemUpdated event why? all of your examples are based on objectect datasource or sql data data source please give at least  one example  with dataset or data table that is really good for programmers .

i wrote like this

 Protected Sub dgproduct_ItemUpdated(ByVal source As Object, ByVal e As Telerik.Web.UI.GridUpdatedEventArgs) Handles dgProduct.ItemUpdated
        Dim item As String = getItemName(e.Item.OwnerTableView.Name)
        Dim field As String = getFieldName(e.Item.OwnerTableView.Name)
        If Not e.Exception Is Nothing Then
            e.KeepInEditMode = True
            e.ExceptionHandled = True
            DisplayMessage(item + " " + e.Item(field).Text + " cannot be updated. Reason: " + e.Exception.Message)
        Else
            DisplayMessage(item + " " + e.Item(field).Text + " updated")
        End If
    End Sub

 
ds = ProductBO.GetProductChainDetailsList(ddlCategory.SelectedValue, "", txtStyle.Text, ddlStyleActive.SelectedValue, CInt(ViewState("cp").ToString), CInt(SystemSettingsBO.GetSettings("PageSize")))
           ds.Relations.Add("ProductRelation", ds.Tables(0).Columns("PKProductID"), ds.Tables(1).Columns("FKProductID"))
           If Not ds.Tables(2) Is Nothing Then
               If ds.Tables(2).Rows.Count > 0 Then
                   ds.Relations.Add("ProductRelation2", ds.Tables(1).Columns("PKProductID"), ds.Tables(2).Columns("FKProductID"))
               End If
           End If
           'dgProduct.DisplayLayout.AllowUpdateDefault = AllowUpdate.Yes
           dgProduct.DataSource = ds
           dgProduct.DataBind()

 <telerik:RadGrid ID="dgProduct" runat="server" AutoGenerateColumns="false"
                                  AutoGenerateHierarchy="true" GroupingEnabled="true" AllowMultiRowSelection="true"
                                 AllowAutomaticDeletes="True" AllowAutomaticInserts="True"  AllowAutomaticUpdates="True">
                                     <MasterTableView EditMode="InPlace" >
                                         <Columns>
                                          <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn1">
                                     <HeaderStyle Width="20px" />
                                     <ItemStyle CssClass="MyImageButton" />
                                 </telerik:GridEditCommandColumn>
                                             <telerik:GridBoundColumn DataField="PKProductID" HeaderText="PKProductID" Visible="false" />
                                             <telerik:GridBoundColumn DataField="SourceID" HeaderText="Style #" />
                                             <telerik:GridBoundColumn DataField="Language1Title" HeaderText="Title" />
                                             <telerik:GridBoundColumn DataField="Language1SubTitle" HeaderText="Sub Title" />
                                            
                                             <telerik:GridDropDownColumn HeaderText="Clearance" UniqueName="StyleClearance" DataSourceID="SourceCheck"
                                                 ListTextField="Text" ListValueField="Text" SortExpression="Text" DataField="ClearanceItem" />
                                             <telerik:GridDropDownColumn HeaderText="Active" UniqueName="StyleActive" DataSourceID="SourceCheck"
                                                 ListTextField="Text" ListValueField="Text" SortExpression="Text" DataField="Active" />
                                             <telerik:GridBoundColumn DataField="Price" HeaderText="Price" />
                                             <telerik:GridBoundColumn DataField="SalePrice" HeaderText="Sale Price" />
                                               <telerik:GridButtonColumn ConfirmText="Delete this product?" ButtonType="ImageButton"
                                     CommandName="Delete" Text="Delete" UniqueName="DeleteColumn1">
                                     <HeaderStyle Width="20px" />
                                     <ItemStyle HorizontalAlign="Center" CssClass="MyImageButton" />
                                 </telerik:GridButtonColumn>
                                         </Columns>
                                         <DetailTables>
                                             <telerik:GridTableView DataMember="Colors" HierarchyLoadMode="ServerOnDemand"  >
                                            
                                                 <Columns>
                                                     <telerik:GridBoundColumn DataField="FKProductid" HeaderText="FKProductid" Visible="false" />
                                                     <telerik:GridBoundColumn DataField="Language1Title" HeaderText="Title" ReadOnly="true" />
                                                      <telerik:GridBoundColumn DataField="PKGroupScaleItemID" HeaderText="Color Id" ReadOnly="true"  />
                                                     <telerik:GridTemplateColumn UniqueName="TemplateColumn">
                     <ItemTemplate>
                        sfsdadf
                     </ItemTemplate>
                     <EditItemTemplate>
                        <asp:DropDownList DataSourceID="SourceColors" DataTextField="ScaleLanguage1Name" DataValueField="ScaleType"  ID="ddlList" runat="server" AutoPostBack="true" selectedValue='<%# Eval("ScaleLanguage1Name") %>'></asp:DropDownList>
                        
                     </EditItemTemplate>
                 </telerik:GridTemplateColumn>
                                                        <telerik:GridDropDownColumn UniqueName="ColorSourceID" DataSourceID="SourceColors"
                                                         HeaderText="Colors" DataField="SourceID" SortExpression="ScaleLanguage1Name"
                                                         ListTextField="ScaleLanguage1Name" ListValueField="ScaleType" />
                                                     <telerik:GridDropDownColumn HeaderText="Active" UniqueName="ColorActive" DataSourceID="SourceCheck"
                                                         ListTextField="Text" ListValueField="Text" SortExpression="Text" DataField="Active" />
                                                 </Columns>
                                                 <DetailTables>
                                                     <telerik:GridTableView DataMember="Sizes" HierarchyLoadMode="ServerOnDemand"  Width="300px" >
                                                         <Columns>
                                                             <telerik:GridBoundColumn DataField="FKProductid" HeaderText="FKProductid" Visible="false" />
                                                             <telerik:GridBoundColumn DataField="Language1Title" HeaderText="Title" ReadOnly="true"  />
                                                             <telerik:GridBoundColumn DataField="SourceID" HeaderText="Size ID" ReadOnly="true" />
                                                             <telerik:GridDropDownColumn UniqueName="SizeSourceID" DataSourceID="SourceSizes"
                                                                 HeaderText="Sizes" DataField="SourceID" SortExpression="ScaleLanguage1Name" ListTextField="ScaleLanguage1Name"
                                                                 ListValueField="PKGroupScaleItemID" />
                                                             <telerik:GridBoundColumn DataField="BackOrderDays" HeaderText="Back Order Days" />
                                                             <telerik:GridBoundColumn DataField="SKU" HeaderText="SKU" />
                                                             <telerik:GridBoundColumn DataField="QuantityAvailable" HeaderText="Quantity" />
                                                             <telerik:GridDropDownColumn HeaderText="Active" UniqueName="SizeActive" DataSourceID="SourceCheck"
                                                                 ListTextField="Text" ListValueField="Text" SortExpression="Text" DataField="Active" />
                                                         </Columns>
                                                     </telerik:GridTableView>
                                                 </DetailTables>
                                             </telerik:GridTableView>
                                         </DetailTables>
                                         <EditFormSettings>
                                             <EditColumn Reorderable="false" Resizable="false" />
                                         </EditFormSettings>
                                     </MasterTableView>
                                     <ClientSettings>
                                         <ClientEvents OnRowClick="RowClick" OnRowDblClick="RowDblClick" />
                                         
                                     </ClientSettings>
                                 </telerik:RadGrid>


i need solution for this to update the row as early as possible

Thanks & Regards,
M.Koteswara Rao

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 23 Jan 2012, 01:25 PM
Hello,

When you are doing automatic data source operations, you should set the following properties.

  • AllowAutomaticDeletes="True"
  • AllowAutomaticInserts="True"
  • AllowAutomaticUpdates="True"
Make sure that you are using Advanced data binding techniques using NeedDataSource event to bind the grid. Also check the following demo which implements the same.
Grid / Entity Framework Manual Operations

-Shinu.
Tags
Grid
Asked by
koteswararao
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or