RadGrid UpdateCommand doesn't fire inside SimpleView
I've been struggling with something that should take no more than 5 minutes, but has consumed hours by now. I've even gone back and created everything from scratch, hence the funny names below...
I have the following control implemented inside a sitefinity module (sitefinity v4.4) :
public
class
Bob
public
int
Id
get
;
set
;
public
string
Description
get
;
set
;
public
class
TestGridView : SimpleView
private
string
layoutTemplateName =
"TestGridView.ascx"
;
protected
override
string
LayoutTemplateName
get
return
layoutTemplateName;
protected
virtual
RadGrid Grid
get
return
this
.Container.GetControl<RadGrid>(
"uxECGrid"
,
true
);
protected
override
void
InitializeControls(GenericContainer controlContainer)
Grid.NeedDataSource +=
new
GridNeedDataSourceEventHandler(Grid_NeedDataSource);
Grid.UpdateCommand +=
new
GridCommandEventHandler(Grid_UpdateCommand);
Grid.DeleteCommand +=
new
GridCommandEventHandler(Grid_DeleteCommand);
Grid.EditCommand +=
new
GridCommandEventHandler(Grid_EditCommand);
void
Grid_EditCommand(
object
sender, GridCommandEventArgs e)
void
Grid_DeleteCommand(
object
sender, GridCommandEventArgs e)
void
Grid_UpdateCommand(
object
sender, GridCommandEventArgs e)
void
Grid_NeedDataSource(
object
sender, GridNeedDataSourceEventArgs e)
List<Bob> items =
new
List<Bob>();
items.Add(
new
Bob Id = 1, Description =
"desc1"
);
items.Add(
new
Bob Id = 2, Description =
"desc2"
);
Grid.DataSource = items;
<%@ Control Language="C#" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<
link
rel
=
"stylesheet"
type
=
"text/css"
href
=
"/Css/Admin.css"
/>
<
h1
class
=
"sfBreadCrumb"
id
=
"sfToMainContent"
>Test Grid View</
h1
>
<
div
class
=
"sfMain sfWorkArea sfClearfix"
>
<
telerik:RadGrid
runat
=
"server"
Width
=
"100%"
ID
=
"uxECGrid"
AutoGenerateColumns
=
"False"
DataKeyNames
=
"Id"
CellSpacing
=
"0"
>
<
MasterTableView
CommandItemDisplay
=
"Top"
AutoGenerateColumns
=
"false"
DataKeyNames
=
"Id"
InsertItemPageIndexAction
=
"ShowItemOnCurrentPage"
EditMode
=
"Inplace"
>
<
Columns
>
<
telerik:GridEditCommandColumn
ButtonType
=
"ImageButton"
UniqueName
=
"EditCommandColumn"
/>
<
telerik:GridBoundColumn
DataField
=
"Description"
HeaderText
=
"Description"
UniqueName
=
"Description"
/>
<
telerik:GridButtonColumn
ConfirmText
=
"Delete this record?"
ConfirmDialogType
=
"RadWindow"
ConfirmTitle
=
"Delete"
ButtonType
=
"ImageButton"
CommandName
=
"Delete"
ConfirmDialogHeight
=
"100px"
ConfirmDialogWidth
=
"220px"
/>
</
Columns
>
</
MasterTableView
>
</
telerik:RadGrid
>
<
telerik:RadWindowManager
ID
=
"RadWindowManager1"
runat
=
"server"
/>
</
div
>
I solved this eventually, and I'm posting the solution because I KNOW this will help people at some time.
Works like a charm!!!
Thanks a lot...
I upgraded a site to the latest version and found that three pages (out of all the pages) ended up with "Include RadScriptManager" unchecked. I checked these on the three pages, saved and republished the pages. But once I logout and log back in, the Include RadScriptManager button goes back to unchecked in the title and properties of the three pages. I believe that this button being unchecked causes the javascript errors that I see on the site when I go to any of the three pages.
Does anyone know why the button is not remaining checked when I log out of the backend?
Thanks,
Bolade
Thank you Dawid, Instead of "Days Later" it was only hours for me.
JT