Below you will see the demo of the problem I have.
I need from edittemplate of the Grid in ButtonControl to update Message Control in Master Page. If inside of the proxy I don't put
I don't put AjaxSettings - everything is OK and works. But with it it doesn't.
Any suggestions?
I have Master Page
ContentPage
2 user Controls:
Message Control
Button Control with Grid
I need from edittemplate of the Grid in ButtonControl to update Message Control in Master Page. If inside of the proxy I don't put
<telerik:RadAjaxManagerProxy ID="ramProxyShow" runat="server"> |
<AjaxSettings> |
<telerik:AjaxSetting AjaxControlID="RadGrid1"> |
<UpdatedControls> |
<telerik:AjaxUpdatedControl ControlID="RadGrid1" /> |
</UpdatedControls> |
</telerik:AjaxSetting> |
</AjaxSettings> |
</telerik:RadAjaxManagerProxy> |
Any suggestions?
I have Master Page
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="MainMaster.master.cs" Inherits="Test_Web_Application.MainMaster" %> |
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> |
<%@ Register src="UserControls/Message.ascx" tagname="Message" tagprefix="uc1" %> |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
<html xmlns="http://www.w3.org/1999/xhtml" > |
<head runat="server"> |
<title></title> |
<asp:ContentPlaceHolder ID="head" runat="server"> |
</asp:ContentPlaceHolder> |
</head> |
<body> |
<form id="form1" runat="server"> |
<div> |
<uc1:Message ID="MessageInfo" runat="server" /> |
<asp:ContentPlaceHolder ID="ContentBlock" runat="server"> |
</asp:ContentPlaceHolder> |
</div> |
<telerik:radscriptmanager ID="ScriptManager" runat="server"> |
</telerik:radscriptmanager> |
<telerik:radajaxloadingpanel ID="RadAjaxLoadingPanel" runat="server" |
Transparency="20"> |
</telerik:radajaxloadingpanel> |
<telerik:radajaxmanager ID="RadAjaxManager" runat="server" |
DefaultLoadingPanelID="RadAjaxLoadingPanel"> |
</telerik:radajaxmanager> |
</form> |
</body> |
</html> |
using System; |
using System.Collections.Generic; |
using System.Linq; |
using System.Web; |
using System.Web.UI; |
using System.Web.UI.WebControls; |
using Test_Web_Application.UserControls; |
namespace Test_Web_Application |
{ |
public partial class MainMaster : System.Web.UI.MasterPage |
{ |
public Message MessageControl |
{ |
get |
{ |
return MessageInfo; |
} |
} |
protected void Page_Load(object sender, EventArgs e) |
{ |
} |
} |
} |
ContentPage
<%@ Page Title="" Language="C#" MasterPageFile="~/MainMaster.Master" AutoEventWireup="true" CodeBehind="TestMPwithAJAX.aspx.cs" Inherits="Test_Web_Application.TestMPwithAJAX" %> |
<%@ Register src="UserControls/ButtonControl.ascx" tagname="ButtonControl" tagprefix="uc2" %> |
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server"> |
</asp:Content> |
<asp:Content ID="Content3" ContentPlaceHolderID="ContentBlock" runat="server"> |
<uc2:ButtonControl ID="ButtonControlShow" runat="server" /> |
</asp:Content> |
2 user Controls:
Message Control
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Message.ascx.cs" Inherits="Test_Web_Application.UserControls.Message" %> |
<asp:Label ID="LabelMessage" runat="server" Text="Label"></asp:Label> |
using System; |
using System.Collections.Generic; |
using System.Linq; |
using System.Web; |
using System.Web.UI; |
using System.Web.UI.WebControls; |
namespace Test_Web_Application.UserControls |
{ |
public partial class Message : System.Web.UI.UserControl |
{ |
protected void Page_Load(object sender, EventArgs e) |
{ |
} |
public string CurrentMessage |
{ |
get |
{ |
return LabelMessage.Text; |
} |
set |
{ |
LabelMessage.Text = value; |
} |
} |
} |
} |
Button Control with Grid
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ButtonControl.ascx.cs" Inherits="Test_Web_Application.UserControls.ButtonControl" %> |
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> |
<asp:Button ID="ButtonShowMessage" runat="server" Text="Show Message" onclick="ButtonShowMessage_Click" /> |
<telerik:RadGrid ID="RadGrid1" runat="server" GridLines="None" |
AutoGenerateColumns="False" Skin="Office2007" |
onneeddatasource="RadGrid1_NeedDataSource" Width="800px" |
oninsertcommand="RadGrid1_InsertCommand" onitemcreated="RadGrid1_ItemCreated"> |
<ClientSettings> |
<Scrolling AllowScroll="true" /> |
</ClientSettings> |
<MasterTableView DataKeyNames="PaymentFrequencyID" EditMode="EditForms" Width="2000px" CommandItemDisplay="Top"> |
<Columns> |
<telerik:GridTemplateColumn DataField="Disabled" DataType="System.Boolean" |
HeaderText="Disabled" |
UniqueName="Disabled"> |
<ItemTemplate> |
<asp:CheckBox ID="chkDisabled" runat="server" /> |
</ItemTemplate> |
</telerik:GridTemplateColumn> |
</Columns> |
<editformsettings editformtype="Template"> |
<formtemplate> |
<asp:Button ID="btnShowMessageFromTheGrid" runat="server" onclick="btnShowMessageFromTheGrid_Click" Text="Show Message" /> |
</formtemplate> |
</editformsettings> |
</MasterTableView> |
<ClientSettings> |
<Resizing AllowColumnResize="True" /> |
</ClientSettings> |
</telerik:RadGrid> |
<telerik:RadAjaxManagerProxy ID="ramProxyShow" runat="server"> |
<AjaxSettings> |
<telerik:AjaxSetting AjaxControlID="RadGrid1"> |
<UpdatedControls> |
<telerik:AjaxUpdatedControl ControlID="RadGrid1" /> |
</UpdatedControls> |
</telerik:AjaxSetting> |
</AjaxSettings> |
</telerik:RadAjaxManagerProxy> |
using System; |
using System.Collections.Generic; |
using System.Linq; |
using System.Web; |
using System.Web.UI; |
using System.Web.UI.WebControls; |
namespace Test_Web_Application.UserControls |
{ |
public partial class ButtonControl : System.Web.UI.UserControl |
{ |
protected void Page_Load(object sender, EventArgs e) |
{ |
} |
protected void btnShowMessageFromTheGrid_Click(object sender, EventArgs e) |
{ |
(this.Page.Master as MainMaster).MessageControl.CurrentMessage = "TEST TEST"; |
} |
protected void ButtonShowMessage_Click(object sender, EventArgs e) |
{ |
(this.Page.Master as MainMaster).MessageControl.CurrentMessage = "TEST"; |
} |
protected void RadGrid1_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e) |
{ |
var list = new List<TestDIVBorder>(); |
list.Add(new TestDIVBorder() { PaymentFrequencyID = 1, Disabled = true }); |
RadGrid1.DataSource = list; |
} |
protected void RadGrid1_InsertCommand(object source, Telerik.Web.UI.GridCommandEventArgs e) |
{ |
} |
protected void RadGrid1_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e) |
{ |
} |
} |
} |