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