This is a migrated thread and some comments may be shown as answers.
ItemUpdated UpdateCommand ItemCommand not firing
22 Answers 237 Views
This is a migrated thread and some comments may be shown as answers.
Paul Gallen
Top achievements
Rank 1
Paul Gallen asked on 28 Aug 2008, 01:07 PM
Hi

I know there is plenty of posts with the UpdateCommand not firing, but I am at a loss why these event(s) do not get called after clicking on the update link in the grid. My grid is dynamically built, and once running, it has all the features that I requre, however, when clicking on the edit link the approriate event gets called, so far so good, but when I click on the update link none of these events fire.

I handle NeedDataSource and I have tried various combinations of viewstate but to no avail.

Can you advise, thanks

P

Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init

BuildListMembersGrid()

End Sub

Private Sub BuildListMembersGrid()

Dim IsEventList As Boolean = False

Dim UDFS As List(Of CMXModel.UDF)

Dim BaseListName As String

If Me.Request.Cookies("BaseListInfo") IsNot Nothing Then

BaseListName =

Me.Request.Cookies("BaseListInfo").Value.Split("~")(1)

IsEventList =

Me.Request.Cookies("BaseListInfo").Value.Split("~")(0) = "Event"

Using cx As New CMXEntities

UDFS = cx.GetUDFS(BaseListName)

End Using

Me.ViewState("CurrentBaseListName") = BaseListName

Else

Exit Sub

End If

Dim GridBoundColumn As GridBoundColumn

Dim GridCheckBoxColumn As GridCheckBoxColumn

Dim grdBaseListMembers As New RadGrid

grdBaseListMembers.ID =

"grdBaseListMembers"

PlaceHolder1.Controls.Clear()

PlaceHolder1.Controls.Add(grdBaseListMembers)

grdBaseListMembers.Skin =

"Office2007"

grdBaseListMembers.Width = Unit.Percentage(100)

grdBaseListMembers.Height = Unit.Percentage(100)

grdBaseListMembers.EnableViewState =

True

grdBaseListMembers.AllowPaging =

True

grdBaseListMembers.PagerStyle.Mode = GridPagerMode.NextPrevAndNumeric

grdBaseListMembers.AutoGenerateColumns =

False

grdBaseListMembers.AllowMultiRowSelection =

True

grdBaseListMembers.AllowAutomaticUpdates =

False

grdBaseListMembers.AllowAutomaticInserts =

False

grdBaseListMembers.AllowAutomaticDeletes =

False

 

grdBaseListMembers.MasterTableView.PageSize = 10

grdBaseListMembers.MasterTableView.Width = Unit.Percentage(100)

grdBaseListMembers.MasterTableView.DataKeyNames =

New String() {"BaseListID", "BaseContactID", "BaseListMemberID"}

grdBaseListMembers.MasterTableView.EditMode = GridEditMode.InPlace

grdBaseListMembers.MasterTableView.EnableViewState =

True

grdBaseListMembers.MasterTableView.AllowAutomaticUpdates =

False

grdBaseListMembers.MasterTableView.AllowAutomaticInserts =

False

grdBaseListMembers.MasterTableView.AllowAutomaticDeletes =

False

grdBaseListMembers.MasterTableView.EnableViewState =

True

 

grdBaseListMembers.ClientSettings.Selecting.AllowRowSelect =

True

grdBaseListMembers.ClientSettings.EnablePostBackOnRowClick =

True

 

 

Dim SelectCommandColumn As New GridClientSelectColumn

grdBaseListMembers.MasterTableView.Columns.Add(SelectCommandColumn)

SelectCommandColumn.ButtonType = ButtonColumnType.LinkButton

SelectCommandColumn.Text =

"Select"

Dim EditCommandColumn As New GridEditCommandColumn

grdBaseListMembers.MasterTableView.Columns.Add(EditCommandColumn)

EditCommandColumn.ButtonType = ButtonColumnType.LinkButton

EditCommandColumn.UniqueName =

"Edit"

GridBoundColumn =

New GridBoundColumn

grdBaseListMembers.MasterTableView.Columns.Add(GridBoundColumn)

GridBoundColumn.DataField =

"ContactName"

GridBoundColumn.UniqueName =

"ContactName"

GridBoundColumn.HeaderText =

"Contact Name"

GridBoundColumn.HeaderStyle.HorizontalAlign = HorizontalAlign.Center

GridBoundColumn.ReadOnly =

True

GridBoundColumn.DataType = Type.GetType(

"System.String")

GridBoundColumn =

New GridBoundColumn

grdBaseListMembers.MasterTableView.Columns.Add(GridBoundColumn)

GridBoundColumn.DataField =

"OrganisationName"

GridBoundColumn.UniqueName =

"OrganisationName"

GridBoundColumn.HeaderText =

"Org Name"

GridBoundColumn.HeaderStyle.HorizontalAlign = HorizontalAlign.Center

GridBoundColumn.ReadOnly =

True

GridBoundColumn.DataType = Type.GetType(

"System.String")

GridBoundColumn =

New GridBoundColumn

grdBaseListMembers.MasterTableView.Columns.Add(GridBoundColumn)

GridBoundColumn.DataField =

"OfficeName"

GridBoundColumn.UniqueName =

"OfficeName"

GridBoundColumn.HeaderText =

"Office Name"

GridBoundColumn.HeaderStyle.HorizontalAlign = HorizontalAlign.Center

GridBoundColumn.ReadOnly =

True

GridBoundColumn.DataType = Type.GetType(

"System.String")

GridBoundColumn =

New GridBoundColumn

grdBaseListMembers.MasterTableView.Columns.Add(GridBoundColumn)

GridBoundColumn.DataField =

"Phone"

GridBoundColumn.UniqueName =

"Phone"

GridBoundColumn.HeaderText =

"Phone"

GridBoundColumn.HeaderStyle.HorizontalAlign = HorizontalAlign.Center

GridBoundColumn.ReadOnly =

True

GridBoundColumn.DataType = Type.GetType(

"System.String")

If IsEventList Then

GridBoundColumn =

New GridBoundColumn

grdBaseListMembers.MasterTableView.Columns.Add(GridBoundColumn)

GridBoundColumn.DataField =

"HostName"

GridBoundColumn.UniqueName =

"HostName"

GridBoundColumn.HeaderText =

"Host"

GridBoundColumn.HeaderStyle.HorizontalAlign = HorizontalAlign.Center

GridBoundColumn.DataType = Type.GetType(

"System.String")

GridCheckBoxColumn =

New GridCheckBoxColumn

grdBaseListMembers.MasterTableView.Columns.Add(GridCheckBoxColumn)

GridCheckBoxColumn.DataField =

"Invited"

GridCheckBoxColumn.UniqueName =

"Invited"

GridCheckBoxColumn.HeaderText =

"Invited"

GridCheckBoxColumn.ItemStyle.HorizontalAlign = HorizontalAlign.Center

GridCheckBoxColumn.HeaderStyle.HorizontalAlign = HorizontalAlign.Center

GridCheckBoxColumn.DataType = Type.GetType(

"System.Boolean")

GridBoundColumn =

New GridBoundColumn

grdBaseListMembers.MasterTableView.Columns.Add(GridBoundColumn)

GridBoundColumn.DataField =

"InviteStatus"

GridBoundColumn.UniqueName =

"InviteStatus"

GridBoundColumn.HeaderText =

"Invite Status"

GridBoundColumn.HeaderStyle.HorizontalAlign = HorizontalAlign.Center

GridBoundColumn.DataType = Type.GetType(

"System.String")

Else

GridBoundColumn =

New GridBoundColumn

grdBaseListMembers.MasterTableView.Columns.Add(GridBoundColumn)

GridBoundColumn.DataField =

"EMail"

GridBoundColumn.UniqueName =

"EMail"

GridBoundColumn.HeaderText =

"EMail"

GridBoundColumn.HeaderStyle.HorizontalAlign = HorizontalAlign.Center

GridBoundColumn.ReadOnly =

True

GridBoundColumn.DataType = Type.GetType(

"System.String")

End If

'' Loop through the udfs (if any) and append them to the grid. Note these columns are required to

'' be editable, therefore attach the custom Edit Template Column

For Each UDF As CMXModel.UDF In UDFS

Dim ListValue As New ArrayList

Dim gtc As New GridTemplateColumn

gtc.ItemTemplate =

New UDFValueItemTemplateColumn(udf, gtc)

gtc.EditItemTemplate =

New UDFValueEditTemplateColumn(UDF, gtc)

gtc.HeaderTemplate =

New UDFValueHeaderTemplateColumn(UDF, gtc)

gtc.Resizable =

False

gtc.UniqueName =

"GridTemplateColumnUDF~" & UDF.Name

gtc.HeaderStyle.HorizontalAlign = HorizontalAlign.Center

grdBaseListMembers.MasterTableView.Columns.Add(gtc)

Next

AddHandler grdBaseListMembers.ItemDataBound, AddressOf BaseListMembers_ItemDataBound

AddHandler grdBaseListMembers.NeedDataSource, AddressOf BaseListMembers_NeedDataSource

AddHandler grdBaseListMembers.ItemCommand, AddressOf BaseListMembers_ItemCommand

' AddHandler grdBaseListMembers.EditCommand, AddressOf BaseListMembers_EditCommand

'AddHandler grdBaseListMembers.ItemEvent, AddressOf BaseListMembers_ItemEvent

'AddHandler grdBaseListMembers.ItemCreated, AddressOf BaseListMembers_ItemCreated

AddHandler grdBaseListMembers.ItemUpdated, AddressOf BaseListMembers_ItemUpdated

AddHandler grdBaseListMembers.UpdateCommand, AddressOf BaseListMembers_UpdateCommand

End Sub

22 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 28 Aug 2008, 01:14 PM
Hi Paul,

You should not create the grid in NeedDataSource event handler. Please visit these examples for more info:
http://demos.telerik.com/aspnet/Prometheus/Grid/Examples/Hierarchy/DefiningStructure/DefaultCS.aspx
http://demos.telerik.com/aspnet/Prometheus/Grid/Examples/Programming/GroupBy/DefaultCS.aspx

Regards,
Vlad
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Paul Gallen
Top achievements
Rank 1
answered on 28 Aug 2008, 02:19 PM
Thanks for the response,

I did not create the grid in the NeedDataSource event handler I created the grid in the Page Init, please view supplied code

Thanks

P
0
Vlad
Telerik team
answered on 28 Aug 2008, 03:11 PM
Hello Paul,

Sorry for this miscommunication. Can you send us via support ticket small example which demonstrates this behavior? I will gladly help you.

Sincerely yours,
Vlad
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Paul Gallen
Top achievements
Rank 1
answered on 28 Aug 2008, 03:45 PM

The application is very big, and it will take me some considerable time to strip it down to give to you as an example. I thought you would might spot something obvious or give me some pointers.

The grid I have created dynamically works fine in every respect, this includes custom templated colums for the header, Item and Edit, simply, the grid does not receive the ‘update’ event after an edit.

Best

P

0
Sean
Top achievements
Rank 2
answered on 28 Aug 2008, 10:51 PM
Hi Paul,

Where is your code for updates held? In this case, I think there needs to be a call in the ItemCoimmand method that determines the type of event. From there, pass off to the Update, Delete, etc..

You didn't define the handlers in the code given, but if your code is in the itemupdated, it woun't reach it. The grid only knows that you clicked a button in the EditCommandColumn; it doesn't know WHAT happened until it enters the ItemCommand event handler.

Also, do you need to explicitly declare AllowAutomaticUpdates? I know that they deal with object datasources, but perhaps setting them False is causing an issue?

Thanks for listening.

Sean
Electronic Arts, Orlando FL
0
Paul Gallen
Top achievements
Rank 1
answered on 29 Aug 2008, 08:50 AM

Thanks Sean for your time, I really appreciate it.

 

In the code supplied, I do hook up to the ItemCommand Event, I have also tried various combinations of setting the AllowAutomaticUpdates and the viewstate, but still, this event does not get fired on an update click.

 

The ItemCommand Event does fire on an edit click but not on a update click, I am still at a loss why this event does not fire.

 

Thanks


P

0
Paul Gallen
Top achievements
Rank 1
answered on 29 Aug 2008, 04:18 PM
Hi,

Just an update, how are you getting on with this issue

P
0
Paul Gallen
Top achievements
Rank 1
answered on 02 Sep 2008, 09:01 AM
Guys


This is becoming a major issue for me, can anyone help?



Ken
0
Sebastian
Telerik team
answered on 02 Sep 2008, 10:11 AM
Hello Paul,

Can you verify that you instantiate your grid programmatically in par with the concepts listed in this article from the documentation? Additionally, verify that you use advanced binding with NeedDataSource handling as explained here.

The information provided so far is not sufficient to pinpoint the source of the problem, therefore the best means to progress in our investigation is to send a stripped working version of your project, exhibiting the issue, attached to formal ticket. We will test it locally and will advice you further.

Best regards,
Stephen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Paul Gallen
Top achievements
Rank 1
answered on 02 Sep 2008, 04:21 PM
Thanks for your help.

If I send you a stripped down project, what does entail? My project is run over the ADO Entity Framework. I suppose I will have to send you the model and the DB.


However, may I suggest an easier alternative:- Can you send me a simple dynamic grid which demonstrates the edit and Update event in action

Thanks P
0
Sebastian
Telerik team
answered on 03 Sep 2008, 08:40 AM
Hi Paul,

You will find the requested example attached to this forum post. Note that using a different data layer should not make a difference as long as you assign the data source returned from the DAL inside the NeedDataSource handler of the grid.

Best regards,
Stephen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Paul Gallen
Top achievements
Rank 1
answered on 03 Sep 2008, 11:13 AM

Thank you for your time I really appreciate the attentiveness.

The sample that you sent me , does not compile. I managed to compile the app by adding a RadScriptManager to the designer surface, then from its context sensitive menu add the WebResource.axd

That Done....

When the app was running, I edited a value (contact name), then clicked the update button, the Update did not take place, the value was unchanged.

This is exactly the same behaviour that I am experiencing (why I raised this issue)

mmm….

I am using Visual Studio 2008 SP1, .NET Framework SP1. The app that you sent me is not at this version.

Do you want me to send you the demo app that you gave me re-configured for this environment.

Hope this Helps

P

0
Sebastian
Telerik team
answered on 03 Sep 2008, 11:25 AM
Hello Paul,

The actual update operation is not implemented in the example, however if you attach the UpdateCommand/ItemCommand events of the grid they should be raised when you click the update button.

Can you please verify that on your machine? If you would like to implement manual data editing for your grid control, review the following online demos which demonstrate possible approaches:

http://demos.telerik.com/ASPNET/Prometheus/Grid/Examples/DataEditing/EditModes/DefaultCS.aspx
http://demos.telerik.com/ASPNET/Prometheus/Grid/Examples/DataEditing/ExtractValues/DefaultCS.aspx

Best regards,
Stephen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Paul Gallen
Top achievements
Rank 1
answered on 03 Sep 2008, 01:57 PM
Thanks Stephen

I have not been able to get my update event to fire, but what I have noticed between your demo app and my app is the order of events

Your App :

ItemCommand -> NeedDataSource

My App

NeedDataSource -> ItemCommand

for both Edit and Update click.

Does this makes any difference?

P
0
Paul Gallen
Top achievements
Rank 1
answered on 03 Sep 2008, 02:10 PM
Typo

Should read 


Your App :

ItemCommand -> NeedDataSource

My App

NeedDataSource -> ItemCommand

for the Edit click.

Does this makes any difference?
0
Sebastian
Telerik team
answered on 03 Sep 2008, 02:27 PM
Hello Paul,

The proper sequence of events raised should be:

ItemCommand -> NeedDataSource

as listed in this topic from the online documentation. Is it possible that by some reason you disabled the viewstate for your grid instance? This might be the reason for the unexpected behavior you observed.

Best regards,
Stephen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Paul Gallen
Top achievements
Rank 1
answered on 03 Sep 2008, 02:40 PM
Hi Stephen

I do not turn off the viewstate for the dynamic grid, and just to make sure I have expliticly Enabled the viewstate

Dim grdBaseListMembers As New RadGrid

grdBaseListMembers.ID =

"grdBaseListMembers1"

 

grdBaseListMembers.EnableViewState =

True

grdBaseListMembers.Skin =

"Office2007"

grdBaseListMembers.Width = Unit.Percentage(100)

grdBaseListMembers.Height = Unit.Percentage(100)

grdBaseListMembers.PagerStyle.Mode = GridPagerMode.NextPrevAndNumeric

grdBaseListMembers.MasterTableView.AutoGenerateColumns =

False

grdBaseListMembers.MasterTableView.PageSize = 10

grdBaseListMembers.MasterTableView.AllowPaging =

True

grdBaseListMembers.MasterTableView.Width = Unit.Percentage(100)

grdBaseListMembers.MasterTableView.DataKeyNames =

New String() {"BaseListID", "BaseContactID", "BaseListMemberID"}

grdBaseListMembers.MasterTableView.EditMode = GridEditMode.InPlace

grdBaseListMembers.ClientSettings.Selecting.AllowRowSelect =

True

grdBaseListMembers.ClientSettings.EnablePostBackOnRowClick =

True

AddHandler grdBaseListMembers.NeedDataSource, AddressOf BaseListMembers_NeedDataSource

AddHandler grdBaseListMembers.ItemCommand, AddressOf BaseListMembers_ItemCommand

AddHandler grdBaseListMembers.ItemDataBound, AddressOf BaseListMembers_ItemDataBound

AddHandler grdBaseListMembers.ItemUpdated, AddressOf BaseListMembers_ItemUpdated

AddHandler grdBaseListMembers.UpdateCommand, AddressOf BaseListMembers_UpdateCommand

P

0
Sebastian
Telerik team
answered on 03 Sep 2008, 02:56 PM
Hi Paul,

I am running out of ideas here. To progress in our investigation, can you modify the sample project I prepared for you in order to make the abnormality surface and send it back attached in a standard support ticket? Thus I will do my best to advice you further/provide a solution for your case.

Best regards,
Stephen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Paul Gallen
Top achievements
Rank 1
answered on 03 Sep 2008, 03:13 PM
OK, I agree, will do


P
0
Paul Gallen
Top achievements
Rank 1
answered on 03 Sep 2008, 04:14 PM
Hi Stephen

I have manged to get th update click to work along with the correct order of events (but unfortunatly I do not know why)

I have moved the placeholder where my (dynamic grid resides) from one part of the page to another location. The PlaceHolder was in a RadPane and I moved it to a RadSlidingPane, both of these panes are in a RadSplitter,

And it all burst into life...


0
Gary
Top achievements
Rank 1
answered on 03 Sep 2008, 05:20 PM
Hi-

I ran into somewhat of the same issue, I was setting up a grid in a control used in another control.  The grid is within a RadPanel, same issue, no OnUpdateCommand event, although the OnDeleteCommand works.

Gary
0
Paul Gallen
Top achievements
Rank 1
answered on 04 Sep 2008, 08:12 AM
Hi Gary

I think the radGrid has some sort of issues with this layout configuration. I have tried all of the telerik recommendations regarding the 'dynamic grid', but to no avail. I am going to have to redesign my web page so I can get the functionality I require .i.e. Sinking the ItemCommand 'Update' event.


Paul
Tags
Ajax
Asked by
Paul Gallen
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Paul Gallen
Top achievements
Rank 1
Sean
Top achievements
Rank 2
Sebastian
Telerik team
Gary
Top achievements
Rank 1
Share this question
or