Hi
Codebehind
Maybe/hopefully I'm only missing something but I can't get any ajax functionality get to work in content or masterpages since I updated to beta 2.
I tried it with a new and empty Wep Application Project with only the Telerik dlls referenced and no entrys in the Web.Config except the 3 for the telerik tagprefix and the scriptmanager axd (handlers/httpHandlers). Everything works fine as long the RadScriptManager and RadAjaxManager are together on a normal webform.
My Code
<telerik:RadScriptManager runat="server" ID="scriptManager" /> |
<telerik:RadAjaxManager runat="server" ID="ajaxManager"> |
<AjaxSettings> |
<telerik:AjaxSetting AjaxControlID="btnClick"> |
<UpdatedControls> |
<telerik:AjaxUpdatedControl ControlID="btnClick" LoadingPanelID="ajaxLoading" /> |
</UpdatedControls> |
</telerik:AjaxSetting> |
</AjaxSettings> |
</telerik:RadAjaxManager> |
<telerik:RadAjaxLoadingPanel runat="server" ID="ajaxLoading" Skin="Hay" /> |
<asp:Button runat="server" Text="CLICK" ID="btnClick" OnClick="btnClick_Click" /> |
protected void btnClick_Click(object sender, EventArgs e) |
{ |
btnClick.Text = new Random().NextDouble().ToString(); |
} |
But if I move the same code to a masterpage my button isn't working anymore and I get a JS Error 'get_postBackElement().id' is null or not an object.
I tried the latest builds (2009.02.1025.35) and beta of q3 (2009.3.1016.35).
I can send in a example project if you like but I think its easy to recreate...
Thanks for any hints and tipps...!
17 Answers, 1 is accepted
0
Hi Joerg,
Indeed we are aware of this problem but unfortunately it is in the .Net Framework and there is little we can do to fix it. You can see for yourself if you try to use MS UpdatePanel instead in the same scenario and set UseSubmitBehavior="false" for the button (although it does not throw an error the control simply does a regular postback). I can suggest you to workaround it by setting the ClientIDMode property of the Page to "AutoID". You can read more details about this property in the following blog post:
http://west-wind.com/weblog/posts/54760.aspx
Kind regards,
Pavel
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Indeed we are aware of this problem but unfortunately it is in the .Net Framework and there is little we can do to fix it. You can see for yourself if you try to use MS UpdatePanel instead in the same scenario and set UseSubmitBehavior="false" for the button (although it does not throw an error the control simply does a regular postback). I can suggest you to workaround it by setting the ClientIDMode property of the Page to "AutoID". You can read more details about this property in the following blog post:
http://west-wind.com/weblog/posts/54760.aspx
Kind regards,
Pavel
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0

Softec
Top achievements
Rank 1
answered on 29 Oct 2009, 02:33 PM
I wrote some JavaScript/jQuery code for my control but please post news as soon you know more about this issue! Thanks!
0

Mehmet Tirgil
Top achievements
Rank 1
answered on 25 Nov 2009, 01:15 PM
Hi,
i have also same problem. i try to use draganddrop for reorder in radgrid. Is there any fix for this situation.
i have also same problem. i try to use draganddrop for reorder in radgrid. Is there any fix for this situation.
0
Hello Mehmet,
Doesn't the previously suggested workaround address the problem for you? If not please provide more details on how to reproduce the problem.
Best wishes,
Pavel
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Doesn't the previously suggested workaround address the problem for you? If not please provide more details on how to reproduce the problem.
Best wishes,
Pavel
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0

Mehmet Tirgil
Top achievements
Rank 1
answered on 01 Dec 2009, 07:05 AM
i tried to set autoid property, i can not solve. But i decide to use serverside, not to clientside mode. So everything is ok now.
this problem occurs only in clientside mode.
Thanks
this problem occurs only in clientside mode.
Thanks
0

Stefan
Top achievements
Rank 2
answered on 28 Feb 2010, 03:58 PM
That did it for me, with the Auto property.
0

Josh
Top achievements
Rank 1
answered on 30 Dec 2010, 05:19 AM
The work around works for me... but I'm using ver. 2010.3.1215.40
Has this still not been addressed or did I miss the thread on how to properly correct this?
Thanks for any updates... honestly its not that crucial... i mean it works... just seems a bit silly :)
Has this still not been addressed or did I miss the thread on how to properly correct this?
Thanks for any updates... honestly its not that crucial... i mean it works... just seems a bit silly :)
0
Hi Josh,
The problem was fixed within the .Net framework for the official release of its 4.0 version. Can you confirm you are using the official release? If that is the case, we will need more information on how to reproduce the problem.
Kind regards,
Pavel
the Telerik team
The problem was fixed within the .Net framework for the official release of its 4.0 version. Can you confirm you are using the official release? If that is the case, we will need more information on how to reproduce the problem.
Kind regards,
Pavel
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0

Josh
Top achievements
Rank 1
answered on 30 Dec 2010, 05:14 PM
Thanks for the reply, here is what I am currently using:
VS2010 Premium ver. 10.0.30319.1 RTMRel
.Net Framework ver. 4.0.30319 RTMRel
markup and code...
<
asp:Content
ID
=
"content"
ContentPlaceHolderID
=
"DefaultContent"
runat
=
"Server"
>
<
telerik:RadAjaxManager
ID
=
"CreateDealRadAjaxManager"
runat
=
"server"
>
<
AjaxSettings
>
<
telerik:AjaxSetting
AjaxControlID
=
"DealSearchRadGrid"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"DealSearchRadGrid"
LoadingPanelID
=
"RadAjaxLoadingPanel1"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
<
telerik:AjaxSetting
AjaxControlID
=
"ClearFiltersLinkButton"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"DealSearchRadGrid"
LoadingPanelID
=
"RadAjaxLoadingPanel1"
/>
<
telerik:AjaxUpdatedControl
ControlID
=
"ClearFiltersLinkButton"
LoadingPanelID
=
"RadAjaxLoadingPanel1"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
</
AjaxSettings
>
</
telerik:RadAjaxManager
>
<
div
id
=
"DealSearchWrapper"
class
=
"clearfix"
style="width: 100%; margin-top: 20px;
float: left">
<
telerik:RadGrid
ID
=
"DealSearchRadGrid"
runat
=
"server"
DataSourceID
=
"DealSearchSqlDataSourceID"
AllowFilteringByColumn
=
"True"
GridLines
=
"None"
AllowPaging
=
"True"
AutoGenerateColumns
=
"False"
ShowGroupPanel
=
"false"
Skin
=
"Black"
OnItemCommand
=
"DealSearchEditCommand"
OnItemDataBound
=
"DealSearchRadGridItemDataBound"
>
<
MasterTableView
GridLines
=
"Horizontal"
AllowFilteringByColumn
=
"true"
TableLayout
=
"Auto"
DataKeyNames
=
"EntityID, StatusCodeID"
>
<
Columns
>
<
telerik:GridTemplateColumn
HeaderText
=
"Action"
UniqueName
=
"TemplateColumn"
AllowFiltering
=
"false"
>
<
ItemTemplate
>
<
asp:LinkButton
ID
=
"ViewDealLinkButton"
runat
=
"server"
Text
=
"View"
CommandName
=
"Custom"
CommandArgument
=
"View"
></
asp:LinkButton
>
<
asp:LinkButton
ID
=
"EditDealLinkButton"
runat
=
"server"
Text
=
"Edit"
CommandName
=
"Custom"
CommandArgument
=
"Edit"
></
asp:LinkButton
>
<
asp:LinkButton
ID
=
"VoidDealLinkButton"
runat
=
"server"
Text
=
"Void"
CommandName
=
"Custom"
CommandArgument
=
"Void"
></
asp:LinkButton
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridBoundColumn
FilterControlAltText
=
"Filter Customer Name/Number"
HeaderText
=
"Customer Name/Number"
UniqueName
=
"CustomerNameNumber"
DataField
=
"CustomerNameNumber"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
FilterControlAltText
=
"Filter Retailer"
HeaderText
=
"Retailer"
UniqueName
=
"Retailer"
DataField
=
"Retailer"
>
</
telerik:GridBoundColumn
>
</
Columns
>
<
CommandItemSettings
ExportToPdfText
=
"Export to Pdf"
ExportToExcelText
=
"Export to Excel"
>
</
CommandItemSettings
>
<
RowIndicatorColumn
FilterControlAltText
=
"Filter RowIndicator column"
>
<
HeaderStyle
Width
=
"20px"
></
HeaderStyle
>
</
RowIndicatorColumn
>
<
ExpandCollapseColumn
FilterControlAltText
=
"Filter ExpandColumn column"
>
<
HeaderStyle
Width
=
"20px"
></
HeaderStyle
>
</
ExpandCollapseColumn
>
<
EditFormSettings
EditFormType
=
"Template"
>
</
EditFormSettings
>
</
MasterTableView
>
<
GroupingSettings
CaseSensitive
=
"false"
/>
<
FilterMenu
EnableImageSprites
=
"False"
>
</
FilterMenu
>
<
HeaderContextMenu
CssClass
=
"GridContextMenu GridContextMenu_Default"
>
</
HeaderContextMenu
>
<
ClientSettings
AllowDragToGroup
=
"false"
>
<
Scrolling
AllowScroll
=
"true"
/>
</
ClientSettings
>
</
telerik:RadGrid
>
<
div
class
=
"contentButtonContainer"
style
=
"float: right;"
>
<
div
class
=
"formControl"
>
<
asp:LinkButton
ID
=
"ClearFiltersLinkButton"
runat
=
"server"
CssClass
=
"searchButton"
Text
=
"Clear Filters"
Width
=
"100px"
Style
=
"text-align: center"
OnClick
=
"ClearFiltersClick"
>
</
asp:LinkButton
>
<
asp:LinkButton
ID
=
"ExportToExcelLinkButton"
runat
=
"server"
CssClass
=
"searchButton"
Text
=
"Export To Excel"
OnClick
=
"ExportToExcelClick"
Width
=
"100px"
Style
=
"text-align: center"
>
</
asp:LinkButton
>
</
div
>
</
div
>
</
div
>
<
telerik:RadAjaxLoadingPanel
HorizontalAlign
=
"center"
BackColor
=
"#ffffff"
ID
=
"RadAjaxLoadingPanel1"
runat
=
"server"
Transparency
=
"30"
Height
=
"100%"
Width
=
"100%"
>
<
table
width
=
"100%"
style
=
"height: 100%"
>
<
tr
>
<
td
>
<
img
src
=
"/App_Themes/images/ajax-loader.gif"
/>
</
td
>
</
tr
>
</
table
>
</
telerik:RadAjaxLoadingPanel
>
<
asp:SqlDataSource
ID
=
"DealSearchSqlDataSourceID"
runat
=
"server"
></
asp:SqlDataSource
>
</
asp:Content
>
private
DealSearchPresenter _presenter;
[CreateNew]
public
DealSearchPresenter Presenter
{
get
{
return
this
._presenter;
}
set
{
if
(value ==
null
)
throw
new
ArgumentNullException(
"value"
);
this
._presenter = value;
this
._presenter.View =
this
;
}
}
protected
void
Page_Load(
object
sender, EventArgs e)
{
//Telerik Hack because on the first clear filter press its throws a js error Error 'get_postBackElement().id' is null or not an object
this
.Page.ClientIDMode = System.Web.UI.ClientIDMode.AutoID;
if
(!
this
.IsPostBack)
{
this
._presenter.OnViewInitialized();
}
this
._presenter.OnViewLoaded();
SetupSQLDataSourceForFilteredGrid();
}
private
void
SetupSQLDataSourceForFilteredGrid()
{
DealSearchSqlDataSourceID.ConnectionString = ConfigurationManager.ConnectionStrings[
"ApplicationConnectionString"
].ConnectionString;
DealSearchSqlDataSourceID.SelectCommandType = SqlDataSourceCommandType.StoredProcedure;
DealSearchSqlDataSourceID.SelectCommand =
"somesproc"
;
DealSearchSqlDataSourceID.ProviderName =
"System.Data.SqlClient"
;
}
public
void
ConfigureExport()
{
DealSearchRadGrid.ExportSettings.ExportOnlyData =
true
;
DealSearchRadGrid.ExportSettings.IgnorePaging =
true
;
DealSearchRadGrid.ExportSettings.OpenInNewWindow =
true
;
}
#region events
protected
void
DealSearchRadGridItemDataBound(
object
source, GridItemEventArgs e)
{
if
(e.Item.ItemType == GridItemType.Item)
{
LinkButton viewLinkButton = ((LinkButton)e.Item.FindControl(
"ViewDealLinkButton"
));
LinkButton editModifyLinkButton = ((LinkButton)e.Item.FindControl(
"EditDealLinkButton"
));
LinkButton voidLinkButton = ((LinkButton)e.Item.FindControl(
"VoidDealLinkButton"
));
int
statusCodeID = (
int
)(e.Item
as
GridDataItem).OwnerTableView.DataKeyValues[e.Item.ItemIndex][
"StatusCodeID"
];
if
(statusCodeID.Equals(DraftStatusCodeID))
{
viewLinkButton.Visible =
true
;
editModifyLinkButton.Text =
"Modify"
;
voidLinkButton.Visible =
true
;
}
if
(statusCodeID.Equals(NewStatusCodeID))
{
viewLinkButton.Visible =
true
;
editModifyLinkButton.Text =
"Adjust"
;
voidLinkButton.Visible =
true
;
}
if
(statusCodeID.Equals(InitialapprovedStatusCodeID))
{
viewLinkButton.Visible =
true
;
editModifyLinkButton.Text =
"Adjust"
;
voidLinkButton.Visible =
true
;
}
if
(statusCodeID.Equals(FinalapprovedStatusCodeID))
{
viewLinkButton.Visible =
true
;
editModifyLinkButton.Text =
"Adjust"
;
voidLinkButton.Visible =
true
;
}
}
}
protected
void
DealSearchEditCommand(
object
source, GridCommandEventArgs e)
{
if
(e.Item.GetType()!=
typeof
(GridDataItem))
return
;
string
entityID = (e.Item
as
GridDataItem).OwnerTableView.DataKeyValues[e.Item.ItemIndex][
"EntityID"
].ToString();
string
statusCodeID = (e.Item
as
GridDataItem).OwnerTableView.DataKeyValues[e.Item.ItemIndex][
"StatusCodeID"
].ToString();
string
redirectString = String.Format(
"CreatDeal.aspx?pr={0}&sc={1}"
, entityID, statusCodeID);
switch
(e.CommandArgument.ToString())
{
//View and Edit are Basically the same just leaving room for growth or alterations.
case
"View"
:
Response.Redirect(redirectString);
break
;
case
"Edit"
:
Response.Redirect(redirectString);
break
;
case
"Void"
:
VoidDeal(entityID.ToInt());
break
;
default
:
break
;
}
}
protected
void
ExportToExcelClick(
object
sender, EventArgs e)
{
ConfigureExport();
DealSearchRadGrid.MasterTableView.ExportToExcel();
}
protected
void
ClearFiltersClick(
object
sender, EventArgs e)
{
foreach
(GridColumn column
in
DealSearchRadGrid.MasterTableView.Columns)
{
column.CurrentFilterFunction = GridKnownFunction.NoFilter;
column.CurrentFilterValue =
string
.Empty;
}
DealSearchRadGrid.MasterTableView.FilterExpression =
string
.Empty;
DealSearchRadGrid.MasterTableView.Rebind();
}
0
Hi Josh,
I was able to reproduce the error. It occurs when there is a 4.0 version of the AjaxToolKit in the bin folder of the website. In this case the scripts are loaded from the ToolKit's assembly even if you don't use that in your project. This assembly uses different scripts than the ones which ship with the RTM version of .Net 4.0 and this is causing the error with our RadAjaxManager. You can workaround it by registering the correct scripts via ScriptManager like this:
I am attaching a test page containing the correct scripts and illustrating the suggested approach. I hope this helps.
All the best,
Pavel
the Telerik team
I was able to reproduce the error. It occurs when there is a 4.0 version of the AjaxToolKit in the bin folder of the website. In this case the scripts are loaded from the ToolKit's assembly even if you don't use that in your project. This assembly uses different scripts than the ones which ship with the RTM version of .Net 4.0 and this is causing the error with our RadAjaxManager. You can workaround it by registering the correct scripts via ScriptManager like this:
<
telerik:RadScriptManager
ID
=
"RadScriptManager1"
Runat
=
"server"
>
<
Scripts
>
<
asp:ScriptReference
Assembly
=
"System.Web.Extensions"
Name
=
"MicrosoftAjax.js"
ScriptMode
=
"Release"
Path
=
"~/AjaxScripts/MicrosoftAjax.js"
/>
<
asp:ScriptReference
Assembly
=
"System.Web.Extensions"
Name
=
"MicrosoftAjaxWebForms.js"
ScriptMode
=
"Release"
Path
=
"~/AjaxScripts/MicrosoftAjaxWebForms.js"
/>
</
Scripts
>
</
telerik:RadScriptManager
>
I am attaching a test page containing the correct scripts and illustrating the suggested approach. I hope this helps.
All the best,
Pavel
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0

Josh
Top achievements
Rank 1
answered on 04 Jan 2011, 05:02 PM
Awesome!! you rock thank you sooooo much!!!
0

Manuel Ortiz
Top achievements
Rank 1
answered on 09 Jan 2011, 10:17 PM
Hi,
Does the last version of the Telerik files solves this problem without having to load the MicrosoftAjax.js files by hand? How can I find the last version of the MicrosoftAjax.js files for download? Is there another workaround instead of loading these files?
Thanks,
Manuel
Does the last version of the Telerik files solves this problem without having to load the MicrosoftAjax.js files by hand? How can I find the last version of the MicrosoftAjax.js files for download? Is there another workaround instead of loading these files?
Thanks,
Manuel
0
Hi Manuel,
You can find the necessary scripts in the previously attached sample website. The other workaround is to use ClientIDMode="AutoID" for the controls which are ajaxified with RadAjaxManager. Since the problem is in the framework's scripts, we cannot provide a fix in our assembly.
Regards,
Pavel
the Telerik team
You can find the necessary scripts in the previously attached sample website. The other workaround is to use ClientIDMode="AutoID" for the controls which are ajaxified with RadAjaxManager. Since the problem is in the framework's scripts, we cannot provide a fix in our assembly.
Regards,
Pavel
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0

Manuel Ortiz
Top achievements
Rank 1
answered on 10 Jan 2011, 07:07 PM
Hello,
I am receiving the following error when I add the MicrosoftAjax script references:
Microsoft JScript runtime error: AjaxControlToolkit requires ASP.NET Ajax 4.0 scripts. Ensure the correct version of the scripts are referenced. If you are using an ASP.NET ScriptManager, switch to the ToolkitScriptManager in AjaxControlToolkit.dll.
How can I solve this?
Manuel
I am receiving the following error when I add the MicrosoftAjax script references:
Microsoft JScript runtime error: AjaxControlToolkit requires ASP.NET Ajax 4.0 scripts. Ensure the correct version of the scripts are referenced. If you are using an ASP.NET ScriptManager, switch to the ToolkitScriptManager in AjaxControlToolkit.dll.
How can I solve this?
Manuel
0
Hi Manuel,
This error is probably caused by the fact that AjaxToolkit cannot work with the official .Net 4.0 scripts. You can read more about problems with AjaxToolkit in .Net 4.0 in this forum thread.
All the best,
Pavel
the Telerik team
This error is probably caused by the fact that AjaxToolkit cannot work with the official .Net 4.0 scripts. You can read more about problems with AjaxToolkit in .Net 4.0 in this forum thread.
All the best,
Pavel
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0

Yusuf
Top achievements
Rank 1
answered on 21 May 2012, 03:00 AM
Hi, I have same problem too.
But I use RadControls for ASP.NET AJAX Q2 2009 and .Net Framework 3.5.
Any solution for this ?
EDIT :
I have converted my project to .NET Framework 4 and use AutoID in my web.config but the problem still occurred.
How can I fix this problem?
But I use RadControls for ASP.NET AJAX Q2 2009 and .Net Framework 3.5.
Any solution for this ?
EDIT :
I have converted my project to .NET Framework 4 and use AutoID in my web.config but the problem still occurred.
How can I fix this problem?
0

أشرف
Top achievements
Rank 1
answered on 22 Dec 2013, 11:06 AM
I created a custom control that suffered from this same problem: It couldn't trigger AJAX requests, and always the a.get_postbackElement() is undefined error erupted.
After debugging Telerik and Microsoft code, I think that the problem is in Microsoft's code. AJAX extensions was introduced long before the ClientIDMode, so MS developers supposed that the ClientID generation scheme is the same the the UniqueID attribute generation scheme with the sole difference of the separator, which doesn't always hold when the ClientIDMode property is set to Inherit.
For example, if a control's UniqueID property (used as the name attribute for HTML inputs and used as the __EVENTTARGET value on post backs) is a$b$c (where a is the ID of the grandparent control, and b is the ID of the parent and c is the ID of the control itself), its ClientID must be a_b_c, and they use the UniqueID value to infer the ClientID property (they just replace $ by _ using a RegEx), and when the code fetches the element using the false id by calling $get (a shortcut for document.getElementById), it returns null and the a.get_postbackElement() is undefined error happens.
The only known fix in my opinion is to force the AutoID value for the ClientIDMode property until Microsoft fixes its carelessly unmaintained code. In my code I overrode it as follows:
After debugging Telerik and Microsoft code, I think that the problem is in Microsoft's code. AJAX extensions was introduced long before the ClientIDMode, so MS developers supposed that the ClientID generation scheme is the same the the UniqueID attribute generation scheme with the sole difference of the separator, which doesn't always hold when the ClientIDMode property is set to Inherit.
For example, if a control's UniqueID property (used as the name attribute for HTML inputs and used as the __EVENTTARGET value on post backs) is a$b$c (where a is the ID of the grandparent control, and b is the ID of the parent and c is the ID of the control itself), its ClientID must be a_b_c, and they use the UniqueID value to infer the ClientID property (they just replace $ by _ using a RegEx), and when the code fetches the element using the false id by calling $get (a shortcut for document.getElementById), it returns null and the a.get_postbackElement() is undefined error happens.
The only known fix in my opinion is to force the AutoID value for the ClientIDMode property until Microsoft fixes its carelessly unmaintained code. In my code I overrode it as follows:
[Browsable(
false
)]
public
override
ClientIDMode ClientIDMode
// HACK: I don't know why the generated ClientID was malformed when this property was set to the default (Inherit) which caused the control to fail in triggering an AJAX request. I had to explicitly set the ID generation mode to AutoID to cope with AJAX
{
get
{
return
ClientIDMode.AutoID;
}
set
{
throw
new
InvalidOperationException();
}
}