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

can not call Grid ItemInserted

1 Answer 165 Views
Grid
This is a migrated thread and some comments may be shown as answers.
khalil_ck2002
Top achievements
Rank 1
khalil_ck2002 asked on 13 Mar 2011, 11:04 AM
Dears,

I have an Telerik grid view with Automatic insert update delete ..but these events didnt call when i clicked to thier releted buttons
as following :


 

 

Protected Sub RadGrid1_ItemInserted(ByVal source As Object, ByVal e As GridInsertedEventArgs) Handles

RadGrid1.ItemInserted

 

 

 

 

 

 

If e.Exception IsNot Nothing

Then

 

 

e.ExceptionHandled =

 

True

 

 

e.KeepInInsertMode =

 

True

 

 

DisplayMessage(

 

True, "Employee cannot be inserted. Reason: " & Convert

.ToString(e.Exception.Message))

 

 

 

 

 

 

Else

 

 

DisplayMessage(

 

False, "Employee inserted"

)

 

 

 

 

 

 

End

If

 

 

 

 

Dim gridEditFormItem As GridEditFormItem = DirectCast(e.Item, GridEditFormItem

)

 

 

 

 

 

 

Dim dropDownList As DropDownList = DirectCast(gridEditFormItem.FindControl("ddlTOC"), DropDownList

)

 

 

 

 

 

 

Dim TextBox As TextBox = DirectCast(gridEditFormItem.FindControl("TextBox8"), TextBox

)

 

 

 

 

 

 

 

 

 

End

Sub


and this is the source code :

 

 

<telerik:RadPageView ID="RadPageView2" runat="server">

 

 

 

<telerik:RadGrid ID="RadGrid1" runat="server" CssClass="RadGrid" GridLines="None"

 

 

 

AllowPaging="True" PageSize="20" AllowSorting="True" AutoGenerateColumns="False"

 

 

 

ShowStatusBar="True" AllowAutomaticDeletes="True" AllowAutomaticInserts="True"

 

 

 

AllowAutomaticUpdates="True" OnItemDeleted="RadGrid1_ItemDeleted" OnItemInserted="RadGrid1_ItemInserted"

 

 

 

OnItemUpdated="RadGrid1_ItemUpdated" OnItemCommand="RadGrid1_ItemCommand" OnPreRender="RadGrid1_PreRender">

 

 

 

<MasterTableView CommandItemDisplay="TopAndBottom" DataKeyNames="الأجراء">

 



any help i will be grateful

 

 

1 Answer, 1 is accepted

Sort by
0
Marin
Telerik team
answered on 16 Mar 2011, 07:07 PM
Hello,

The automatic datasource operation are supported only when the grid binds declaratively to DataSource control (through the DataSourceID property). If you are using advanced databinding (with the NeedDataSource event) then you should handle the InsertCommand / UpdateCommand events and perform the relevant operations as shown here.

Greetings,
Marin
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
Tags
Grid
Asked by
khalil_ck2002
Top achievements
Rank 1
Answers by
Marin
Telerik team
Share this question
or