Hi,
I have a Sharepoint webpart that contains a Radgrid control. This control doesn't work properly in my webpart. I've installed ASP.NET AJAX, I've followed this link "http://www.telerik.com/community/forums/sharepoint-2010/integrate-ajax-controls/telerik-ajax-issue-with-sharepoint-2010.aspx" and Telerik documentation, and the grid doesn't work. When I click in a page number of the grid, nothing happens, but if I click again, all page is reload and the page changes. If I debug the Javascript code of Sharepoint page with Internet Explorer debug, there is an error in the last line of this function, to assing "innerHTML" property, although "updatePanelElement" object exists:
This is the code of my webpart main class:
The code behind of the webpart, in the "Load" method is:
In the ascx file, the RadGrid code is the following code:
I don't know what can I do.
Thank you very much
I have a Sharepoint webpart that contains a Radgrid control. This control doesn't work properly in my webpart. I've installed ASP.NET AJAX, I've followed this link "http://www.telerik.com/community/forums/sharepoint-2010/integrate-ajax-controls/telerik-ajax-issue-with-sharepoint-2010.aspx" and Telerik documentation, and the grid doesn't work. When I click in a page number of the grid, nothing happens, but if I click again, all page is reload and the page changes. If I debug the Javascript code of Sharepoint page with Internet Explorer debug, there is an error in the last line of this function, to assing "innerHTML" property, although "updatePanelElement" object exists:
function
Sys$WebForms$PageRequestManager$_updatePanel(updatePanelElement, rendering) {
for
(
var
updatePanelID
in
this
._scriptDisposes) {
if
(
this
._elementContains(updatePanelElement, document.getElementById(updatePanelID))) {
var
disposeScripts =
this
._scriptDisposes[updatePanelID];
for
(
var
i = 0, l = disposeScripts.length; i < l; i++) {
eval(disposeScripts[i]);
}
delete
this
._scriptDisposes[updatePanelID];
}
}
this
._destroyTree(updatePanelElement);
updatePanelElement.innerHTML = rendering;
}
This is the code of my webpart main class:
private
RadAjaxManager mAjaxManager;
protected
override
void
OnInit(EventArgs e)
{
base
.OnInit(e);
Page.ClientScript.RegisterStartupScript(
typeof
(myWebPart),
this
.ID,
"_spOriginalFormAction = document.forms[0].action;_spSuppressFormOnSubmitWrapper=true;"
,
true
);
if
(
this
.Page.Form !=
null
)
{
string
formOnSubmitAtt =
this
.Page.Form.Attributes[
"onsubmit"
];
if
(!
string
.IsNullOrEmpty(formOnSubmitAtt) && formOnSubmitAtt ==
"return _spFormOnSubmitWrapper();"
)
{
this
.Page.Form.Attributes[
"onsubmit"
] =
"_spFormOnSubmitWrapper();"
;
}
}
ScriptManager scriptManager = ScriptManager.GetCurrent(Page);
if
(scriptManager ==
null
)
{
scriptManager =
new
RadScriptManager();
Page.Form.Controls.Add(scriptManager);
}
SetUpAjaxManagerOnPage();
EnsureChildControls();
}
protected
void
SetUpAjaxManagerOnPage()
{
RadAjaxManager currentAjaxManager = RadAjaxManager.GetCurrent(Page);
if
(currentAjaxManager ==
null
)
{
Page.Form.Controls.AddAt(0, AjaxManager);
Page.Items.Add(
typeof
(RadAjaxManager), AjaxManager);
}
}
protected
virtual
RadAjaxManager AjaxManager
{
get
{
if
(mAjaxManager ==
null
)
{
mAjaxManager = RadAjaxManager.GetCurrent(Page);
if
(mAjaxManager ==
null
)
{
mAjaxManager =
new
RadAjaxManager() { ID =
"RadAjaxManager1"
};
}
}
return
mAjaxManager;
}
}
protected
override
void
CreateChildControls()
{
Control control = Page.LoadControl(_ascxPath);
Controls.Add(control);
}
The code behind of the webpart, in the "Load" method is:
protected
void
Page_Load(
object
sender, EventArgs e)
{
RadAjaxManager manager = RadAjaxManager.GetCurrent(Page);
manager.EnableAJAX =
true
;
manager.AjaxSettings.AddAjaxSetting(gvActuaciones, pnlGrid);
}
In the ascx file, the RadGrid code is the following code:
<asp:Panel ID=
"pnlGrid"
runat=
"server"
>
<telerik:RadGrid ID=
"gvActuaciones"
runat=
"server"
OnNeedDataSource=
"gvActuaciones_NeedDataSource"
AutoGenerateColumns=
"False"
ShowStatusBar=
"True"
AllowPaging=
"True"
ShowFooter=
"True"
PageSize=
"5"
>
<ClientSettings>
<Scrolling AllowScroll=
"true"
UseStaticHeaders=
"true"
SaveScrollPosition=
"true"
></Scrolling>
</ClientSettings>
<MasterTableView TableLayout=
"Fixed"
>
<Columns>
<telerik:GridTemplateColumn AllowFiltering=
"false"
HeaderStyle-Width=
"60px"
HeaderText=
""
>
<ItemTemplate>
...
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridBoundColumn ...>
<telerik:GridBoundColumn ...>
...
</MasterTableView>
</telerik:RadGrid>
</asp:Panel>
I don't know what can I do.
Thank you very much