RadGrid Insert, Update, Delete events not firing
I have created a custom module (using JobsModule as a guide) and have successfully installed and configured it. The module page extends SimpleView.
protected
override
void
InitializeControls(GenericContainer container)
this
.EmployeesGrid.NeedDataSource +=
new
GridNeedDataSourceEventHandler(EmployeesGrid_NeedDataSource);
this
.EmployeesGrid.ItemDataBound +=
new
GridItemEventHandler(EmployeesGrid_ItemDataBound);
this
.EmployeesGrid.InsertCommand +=
new
GridCommandEventHandler(EmployeesGrid_InsertCommand);
this
.EmployeesGrid.UpdateCommand +=
new
GridCommandEventHandler(EmployeesGrid_UpdateCommand);
this
.EmployeesGrid.DeleteCommand +=
new
GridCommandEventHandler(EmployeesGrid_DeleteCommand);
this
.AddButton.Command +=
new
CommandEventHandler(AddButton_Command);
private
RadGrid employeesGrid;
protected
virtual
RadGrid EmployeesGrid
get
if
(employeesGrid ==
null
)
employeesGrid =
base
.Container.GetControl<RadGrid>(
"EmployeesGrid"
,
true
);
return
employeesGrid;
<
telerik:RadGrid
id
=
"EmployeesGrid"
AllowSorting
=
"true"
PageSize
=
"20"
AllowPaging
=
"true"
AllowMultiRowSelection
=
"false"
runat
=
"server"
Gridlines
=
"None"
AutoGenerateColumns
=
"False"
Width
=
"97%"
ShowStatusBar
=
"True"
>
<
PagerStyle
Mode
=
"NextPrevAndNumeric"
/>
<
MasterTableView
AutoGenerateColumns
=
"False"
Summary
=
"Employees"
>
<
CommandItemSettings
AddNewRecordText
=
"Add Photo"
RefreshText
=
"Refresh"
ShowAddNewRecordButton
=
"true"
ShowRefreshButton
=
"true"
/>
<
Columns
>
[...]
</
Columns
>
<
EditFormSettings
>
<
EditColumn
ButtonType
=
"ImageButton"
/>
</
EditFormSettings
>
</
MasterTableView
>
</
telerik:RadGrid
>
Hello Bryan,
There are issues with the RadGrid control commands in Sitefinity 4.0 BETA and BETA2 release. Please take a look at this post for more detailed information.
All the best,
Ivan Dimitrov
the Telerik team
Does this apply to GridView and DataGrid controls too?
Hello Bryan,
There should not be an issue if you use GridView control
sample
<
asp:GridView
runat
=
"server"
ID
=
"GridView1"
allowpaging
=
"true"
PageSize
=
"10"
autogeneratecolumns
=
"false"
AutoGenerateDeleteButton
=
"True"
>
<
columns
>
<
asp:buttonfield
buttontype
=
"Link"
commandname
=
"Add"
text
=
"Add"
/>
<
asp:boundfield
datafield
=
"_title"
headertext
=
"title"
/>
<
asp:boundfield
datafield
=
"_name"
headertext
=
"name"
/>
</
columns
>
</
asp:GridView
>
public
partial
class
ButtonControl : System.Web.UI.UserControl
protected
void
Page_Load(
object
sender, EventArgs e)
GridView1.RowCommand +=
new
GridViewCommandEventHandler(GridView1_RowCommand);
GridView1.RowDeleting +=
new
GridViewDeleteEventHandler(GridView1_RowDeleting);
GridView1.DataSource = GetDataSource();
GridView1.DataBind();
void
GridView1_RowDeleting(
object
sender, GridViewDeleteEventArgs e)
void
GridView1_RowCommand(
object
sender, GridViewCommandEventArgs e)
public
IList<TestSource> GetDataSource()
var list =
new
List<TestSource>();
for
(
int
i=0; i < 100; i++)
var s =
"name"
+ i;
var t =
"title"
+ i;
list.Add(
new
TestSource(t, s));
return
list;
public
class
TestSource
public
TestSource(
string
title,
string
name)
_title = title;
_name = name;
public
string
_title
get
;
set
;
public
string
_name
get
;
set
;
Hi,
this issue isn't solved?
I still can't get Insert, update events firing in Release candidate.
Any idea how to solve?
thanks
Hello,
The problem with the RadGrid is not fixed in the RC. The problem is not in the RadGrid control and it comes from our code. Unfortunately we have to fix this in our code and there is no workaround t the issues. I will try to escalate the issue with higher priority so it will get included in the next build.
All the best,
Ivan Dimitrov
the Telerik team
16/01/2011 This is still the case in final version - This is a MAJOR problem.
Hello CRanaboldo,
The issue still occurs if you bind the control on the server. If you use client side binding and WCF there should not be a problem to subscribe for the events.
All the best,
Ivan Dimitrov
the Telerik team
Dear Ivan
Thanks, I understand, when will server side be fixed? Do you have an example of the approach that you suggested - client side binding and WCF - for me to use as a template
Many thanks
Charles
Hello,
Here is a a link that shows how to bind the RadGrid to WCF. This links shows how to bind the control with client side binding.
If you want to bind the content items you can use ItemsGrid control.
Kind regards,
Ivan Dimitrov
the Telerik team
Hello,
When will the issue of not registering insert, update and cancel events commands be fixed in Sitefinity 4.0?
Thanks!
Hello,
We started working on this and we made progress, but we will need some more time. It turns out that the problem is also related to the ViewState and it will require to change some basics. I hope that we will manage to provide a fix within the next few weeks with one of our internal builds.
Best wishes,
Ivan Dimitrov
the Telerik team
I am having this issue in the 2011 Q1 release. I am just evaluating the quality Telerik so am not familiar with the controls. Is this issue fixed? Hopefully it is just something I am doing. I have used the markup and code from the demo site in my own project but still get the issue.
Any feedback would be appreciated.
Hello Ian,
the problem you are talking about is going to be fixed in 2011 Q1 release of Sitefinity, which is due to be released on April 13th. The issue is not related to Telerik RadControls for ASP.NET Ajax, but rather to Sitefinity.
We have resolved the issue already and we are now in the process of testing the implementation.
Woohoo! can't wait!
No sign of Q1 today, when is it going to be released?
Hello CRanaboldo,
We have an official statement here - http://www.sitefinity.com/devnet/forums/sitefinity-4-x/general-discussions/sitefinity-2011-q1-postponed-by-one-week.aspx
All the best,Hi all,
the new SF version 4.1 is rolled out, but as I can see, the problem with firing updates of grids within a sitefinity application is not solved.
I built a user control with a simple table that performs inserts, updates and deletes. - After then I integrated it into the toolbox as widget. - It appears at the page, you can do sort and so on, but NO update ......
To check if I would be wrong I made an empty webform outside of sitefinity, linked my user control into this test page and: it updates !!!!! Surprise !!!
So does anybody know why this does not perform in SF projects ?????
Regards, Robert
Did you change the layouttemplatename and layouttemplatepath + add virtual paths according to slavo's post?
If not, you are still using the old sitefinity parser
Has anyone figured this problem out yet? I am experiencing issues with RadGrid updates/deletes when used in Sitefinity 4.1. I have a ticket open with Telerik right now, but the "progress" has been slow. This is a major showstopper for me. If anyone has any ideas, it would be extremely helpful to me.
Hello Jim,
I got a tip to make the page Viewstate = active.
Since I did it, my radgrids are firing inserts, updates and deletes ...
May it be also helpful to you.
Regards, robert
Robert,
Thanks for the reply. I received the same tip from Telerik, but they told me to enable the viewstate on the grid as well. I tried that and am still having the problem. Are you using the ItemCommand event to handle your processing, or are you using the UpdateCommand, DeleteCommand, etc?
Thanks,
Jim
I use ItemCommand on mine at it works ok, just check for the commandname being sent in
if
(e.CommandName == "Delete")
@Jim
I made a SF 4.1. test-website, there you can see how i used it. - I have a developer license for TELERIK RADtools ASP.NET AJAX made an .ASCX and embedded this into this page:
http://sf41.zehetleitner.at/vis111
Regards, Robert
@Robert
Robert - would it be possible for you to zip up the actual ASCX file that you created so I could look at that? Obviously, yours works, but mine doesn't. All I can see by the link that you posted is the page source, not the control source.
Thanks for the help,
Jim
@Jim:
as in this wonderful forum we cannot attach a zip-file I put it onto my page: sf41.zehetleitner.at/vis111 and you can download it from there. - Screenshot attached. remarks: there were also problems to open it with Safari 5.05 so please try to use MS IE.
Enjoy your grid .... ;-))
Regards, Robert
@Robert:
Thanks for your help on this. I found the problem, but not sure how to fix. It has something to do with my development machine. I have been working with Telerik (Ivan) on this for the last few days. He supplied a fresh project that had a grid in a user control. I tried to run it on my machine and it failed. I tried to run it on another machine, and it also failed (copied the project from my machine to the other). Then I tried running it on a colleague's machine and it worked perfectly. The difference was the code never touched my machine. I don't understand what causes it or why it happens, but it would seem that any code generated on my machine is somehow "infected" with the issue. I don't know if it is a DLL version issue, windows patch, or what. I don't even know where to begin in finding the root cause. If you have any ideas or suggestions, I would be very grateful.
Jim
Dear All
I have now tested grids, and many other RAD Ajax controls in SF 4.1. Provided you follow Salvo's post and set
enable Viewstate under advanced options for each backend page, they all work fine.
Best wishes
Charles