- Rad ASP.NET Ajax Controls Version: 2013.2.717.40
- ASP.NET Version: 4.0.30319
- .NET 4.0
- Browser: IE 10
Issue: I'm trying to programmatically add ajax settings so that a asp:button click updates a RadGrid on a User Control. The reason that this is being done programmatically is because the User Control is only visible to specific users, and an error was occurring when a user that the Control wasn't visible on used the page.
What is happening, is I get the loading pannel spinner appearing over the button and RadGrid area, but no data. If there is a postback the data shows, or if you manually click the refresh button the data shows on the Grid.
The code pieces in question, there is a site master with the ajaxmanager, and a proxymanager on the user control and the page. The page checks if the user is an Admin then calls a function to set the user control to visible and does a few small things and registers the button with the grid and loading panel to the UserControl's proxymanager. Here are the snippets of the ajax C# and the grid.
Site.MasterPage
<
telerik:RadFormDecorator
ID
=
"RadFormDecorator1"
runat
=
"server"
DecoratedControls
=
"Buttons"
/>
<
telerik:RadAjaxManager
ID
=
"RadAjaxManager1"
runat
=
"server"
>
</
telerik:RadAjaxManager
>
<
telerik:RadAjaxLoadingPanel
runat
=
"server"
ID
=
"LoadingPanel1"
Skin
=
"Default"
/>
UserControl.ascx
<
div
style
=
"padding: 0px; border: solid 1px #000; border-top: none;"
>
<
telerik:RadGrid
ID
=
"RadGrid1"
runat
=
"server"
OnNeedDataSource
=
"RadGrid1_OnNeedDataSource"
GridLines
=
"None"
ShowStatusBar
=
"true"
AllowPaging
=
"true"
PageSize
=
"15"
AllowSorting
=
"true"
style
=
"min-width:925px"
>
<
PagerStyle
Mode
=
"NextPrevNumericAndAdvanced"
/>
<
MasterTableView
AutoGenerateColumns
=
"false"
CommandItemDisplay
=
"Top"
TableLayout
=
"Fixed"
>
<
CommandItemSettings
ShowAddNewRecordButton
=
"false"
ShowExportToCsvButton
=
"false"
ShowExportToExcelButton
=
"false"
ShowExportToPdfButton
=
"false"
ShowExportToWordButton
=
"false"
ShowRefreshButton
=
"true"
/>
<
Columns
>
<
telerik:GridBoundColumn
UniqueName
=
"Date"
DataField
=
"Date"
HeaderText
=
"Date"
Groupable
=
"false"
/>
<
telerik:GridBoundColumn
UniqueName
=
"Guid"
DataField
=
"Guid"
HeaderText
=
"Guid"
Groupable
=
"false"
/>
<
telerik:GridBoundColumn
UniqueName
=
"Name"
DataField
=
"Name"
HeaderText
=
"Name"
Groupable
=
"false"
/>
<
telerik:GridBoundColumn
UniqueName
=
"Value"
DataField
=
"Value"
HeaderText
=
"Value"
Groupable
=
"false"
/>
</
Columns
>
</
MasterTableView
>
<
PagerStyle
Mode
=
"NextPrevAndNumeric"
></
PagerStyle
>
</
telerik:RadGrid
>
</
div
>
<
telerik:RadAjaxManagerProxy
ID
=
"RadAjaxManagerProxy1"
runat
=
"server"
>
<
AjaxSettings
>
</
AjaxSettings
>
</
telerik:RadAjaxManagerProxy
>
<
telerik:RadAjaxLoadingPanel
ID
=
"RadAjaxLoadingPanel1"
runat
=
"server"
Skin
=
"Default"
/>
Default.cs for the page that is being loaded.
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if (User.IsInRole("Admin"))
{
LoadDebugInfo();
DebugInfoDisp.RegisterRadGrid();
DebugInfoDisp.RadAjaxProxy.AjaxSettings.AddAjaxSetting(button, DebugInfoDisp.RadAjaxLoadingPanel);
DebugInfoDisp.RadAjaxProxy.AjaxSettings.AddAjaxSetting(button, DebugInfoDisp.RadAjaxGrid);
}
}
}
I'm still learning to use the ajax controls, I'm not sure what I have wrong. The doc's I have used to get to this point are:
http://www.telerik.com/help/aspnet-ajax/ajax-control-not-updated.html
http://www.telerik.com/help/aspnet-ajax/ajax-add-ajaxsettings-programmatically.html