Hi, I am trying to use RadAjaxManager to cause my gridview to add items when a button is clicked. These items are stored in a session variable. When I use the RadUpdatePanel, everything works as expected, except the whole page reloads and is slow. I would like to show a loading panel over each contorl that is loading (my actual page is quite complex). When I click the button to add an item to the radgrid, it shows the loading panel, but the grid does not show any new items. However if I click other things on the page, the items that were added will appear. I've been searching for quite some time for a solution to my problem. Also note:I'm trying NOT to use javascript if possible. My setup is as follows:
Thanks for your help
<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
CodeBehind="Default.aspx.cs" Inherits="WebApplication5._Default" %>
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>
<
asp:Content
ID
=
"HeaderContent"
runat
=
"server"
ContentPlaceHolderID
=
"HeadContent"
>
</
asp:Content
>
<
asp:Content
ID
=
"BodyContent"
runat
=
"server"
ContentPlaceHolderID
=
"MainContent"
>
<
telerik:RadScriptManager
ID
=
"scmAjax"
runat
=
"server"
ScriptMode
=
"Release"
/>
<
telerik:RadAjaxManager
ID
=
"radAjaxManager"
runat
=
"server"
>
<
AjaxSettings
>
<
telerik:AjaxSetting
AjaxControlID
=
"radAjaxManager"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"RadGrid1"
LoadingPanelID
=
"rlpLoadingPanel"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
<
telerik:AjaxSetting
AjaxControlID
=
"RadButton1"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"RadGrid1"
LoadingPanelID
=
"rlpLoadingPanel"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
<
telerik:AjaxSetting
AjaxControlID
=
"RadGrid1"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"RadGrid1"
LoadingPanelID
=
"rlpLoadingPanel"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
</
AjaxSettings
>
</
telerik:RadAjaxManager
>
<
telerik:RadButton
ID
=
"RadButton1"
runat
=
"server"
Text
=
"Assign"
onclick
=
"RadButton1_Click"
AutoPostBack
=
"true"
>
</
telerik:RadButton
>
<
telerik:RadButton
ID
=
"RadButton2"
runat
=
"server"
Text
=
"Request that will reload grid"
AutoPostBack
=
"true"
>
</
telerik:RadButton
>
<
telerik:RadGrid
ID
=
"RadGrid1"
runat
=
"server"
GridLines
=
"None"
>
</
telerik:RadGrid
>
<
telerik:RadAjaxLoadingPanel
ID
=
"rlpLoadingPanel"
runat
=
"server"
Skin
=
"Default"
IsSticky
=
"false"
>
</
telerik:RadAjaxLoadingPanel
>
</
asp:Content
>
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Web;
using
System.Web.UI;
using
System.Web.UI.WebControls;
namespace
WebApplication5
{
public
struct
Book
{
public
string
title
{
get
;
set
;
}
public
string
author
{
get
;
set
;
}
}
public
partial
class
_Default : System.Web.UI.Page
{
protected
List<Book> GridViewBooks
{
get
{
return
(List<Book>)Session[
"Books"
];
}
set
{
Session[
"Books"
] = value;
}
}
protected
void
Page_Load(
object
sender, EventArgs e)
{
if
(!IsPostBack)
{
List<Book> theBooks =
new
List<Book>();
Book aBook =
new
Book();
aBook.title =
"First book title"
;
aBook.author =
"First book author"
;
theBooks.Add(aBook);
GridViewBooks = theBooks;
BindGrid();
}
}
protected
void
RadButton1_Click(
object
sender, EventArgs e)
{
List<Book> theBooks =
new
List<Book>();
Book aBook =
new
Book();
aBook.title =
"Another title "
+ DateTime.Now.ToString();
aBook.author =
"another book author"
;
theBooks = GridViewBooks;
theBooks.Add(aBook);
GridViewBooks = theBooks;
BindGrid();
}
private
void
BindGrid()
{
//bind gridview
RadGrid1.DataSource = GridViewBooks;
RadGrid1.DataBind();
}
}
}
Thanks for your help