Hi, I have this kind of problem.
I have created a small page, where there is a RadListView control and two user controls that use a RadGridView.
When I made a selection in the RadListView, one user control is updated, while the other not.
Here the code of the user control:
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="BasicControl.ascx.cs" Inherits="RadGridTest.C.BasicControl" %>
<
telerik:RadGrid
RenderMode
=
"Lightweight"
ID
=
"RadGrid1"
AllowAutomaticUpdates
=
"false"
AllowAutomaticDeletes
=
"false"
AllowSorting
=
"true"
EnableViewState
=
"true"
runat
=
"server"
AllowMultiRowSelection
=
"True"
PageSize
=
"3"
AllowPaging
=
"True"
AllowCustomPaging
=
"false"
AllowMultiRowEdit
=
"True"
AllowAutomaticInserts
=
"false"
OnItemCreated
=
"RadGrid_ItemCreated"
OnUpdateCommand
=
"RadGrid1_UpdateCommand"
OnItemCommand
=
"RadGrid1_ItemCommand"
OnNeedDataSource
=
"RadGrid1_NeedDataSource"
AllowFilteringByColumn
=
"true"
>
<
PagerStyle
Mode
=
"NextPrevAndNumeric"
></
PagerStyle
>
<
MasterTableView
Width
=
"100%"
CommandItemDisplay
=
"Top"
EditMode
=
"InPlace"
AutoGenerateColumns
=
"false"
>
<
CommandItemTemplate
>
<
div
style
=
"padding: 5px 5px;"
>
Custom command item template
<
telerik:RadButton
ID
=
"RadButtonAddNew"
Text
=
"Aggiungi"
runat
=
"server"
CommandName
=
"AddNew"
Visible='<%# this.CanAddNewElements %>'></
telerik:RadButton
>
<
telerik:RadButton
ID
=
"RadButtonEditAll"
Text
=
"Modifica"
runat
=
"server"
CommandName=<%# RadGrid.EditAllCommandName %> Visible="<%# this.CanEditElements %>" OnClientClicked=<%#"BtnEditAllPressed" + ClientID %> ></
telerik:RadButton
>
<
telerik:RadButton
ID
=
"RadButtonRemove"
Text
=
"Rimuovi Selezionati"
runat
=
"server"
CommandName
=
"Rimuovi"
></
telerik:RadButton
>
<
telerik:RadButton
ID
=
"RadButtonUpdate"
Text
=
"Aggiorna"
runat
=
"server"
CommandName=<%# RadGrid.UpdateCommandName %> Visible='<%# RadGrid1.EditIndexes.Count > 0 %>'></
telerik:RadButton
>
<
telerik:RadButton
ID
=
"RadButtonCancel"
Text
=
"Annulla"
runat
=
"server"
CommandName=<%# RadGrid.CancelAllCommandName %> ></
telerik:RadButton
>
<
telerik:RadButton
ID
=
"RadButtonFilter"
Text
=
"Cerca"
runat
=
"server"
CommandName=<%# RadGrid.FilterCommandName %> OnClientClicked=<%#"ToggleFilterBar" + ClientID %> AutoPostBack="false"></
telerik:RadButton
>
<
telerik:RadButton
ID
=
"RadButtonRebind"
Text
=
"Refresh"
runat
=
"server"
CommandName
=
"RebindGrid"
></
telerik:RadButton
>
</
div
>
</
CommandItemTemplate
>
</
MasterTableView
>
<
ClientSettings
>
<
Selecting
AllowRowSelect
=
"True"
EnableDragToSelectRows
=
"True"
></
Selecting
>
<
ClientEvents
OnRowDeselected
=
"ItemsRowDeselected"
OnRowSelected
=
"ItemsRowSelected"
OnGridCreated
=
"GridCreated"
/>
</
ClientSettings
>
</
telerik:RadGrid
>
<
asp:Label
ID
=
"Label1"
runat
=
"server"
Visible
=
'false'
Text
=
"Ciao"
/>
<
telerik:RadScriptBlock
ID
=
"RadSciptBlock1"
runat
=
"server"
>
<
script
type
=
"text/javascript"
>
function ItemsRowSelected(sender, args) {
console.log("ItemsRowSelected " + sender.get_id());
...
}
function ItemsRowDeselected(sender, args) {
console.log("ItemsRowDeselected " + sender);
...
}
}
function GridCreated(sender, args) {
console.log("GridCreated" + sender.get_id());
...
}
function BtnEditAllPressed<%= ClientID%>(sender, args) {
...
}
function ToggleFilterBar<%= ClientID%>(sender, args) {
console.log("ToggleFilterBar");
...
}
</
script
>
</
telerik:RadScriptBlock
>
<
telerik:RadAjaxManagerProxy
ID
=
"RadAjaxManagerProxy1"
runat
=
"server"
>
<
AjaxSettings
>
<
telerik:AjaxSetting
AjaxControlID
=
"RadGrid1"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"RadGrid1"
></
telerik:AjaxUpdatedControl
>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
</
AjaxSettings
>
</
telerik:RadAjaxManagerProxy
>
And Here the main page:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Default" %>
<%@ Register TagPrefix="uc" TagName="BasicControl" Src="~/Commons/BasicControl.ascx" %>
<!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
>
<
telerik:RadStyleSheetManager
id
=
"RadStyleSheetManager1"
runat
=
"server"
/>
</
head
>
<
body
>
<
form
id
=
"form1"
runat
=
"server"
>
<
div
>
<
telerik:RadAjaxLoadingPanel
ID
=
"RadAjaxLoadingPanel1"
runat
=
"server"
></
telerik:RadAjaxLoadingPanel
>
<
telerik:RadAjaxManager
ID
=
"RadAjaxManager1"
runat
=
"server"
>
<
AjaxSettings
>
<
telerik:AjaxSetting
AjaxControlID
=
"RadListViewTrattamenti"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"RadListViewTrattamenti"
/>
<
telerik:AjaxUpdatedControl
ControlID
=
"ProcedimentiDedicatiInTrattamentiGrid"
/>
<
telerik:AjaxUpdatedControl
ControlID
=
"ProcedimentiInTrattamentiGrid"
LoadingPanelId
=
"RadAjaxLoadingPanel1"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
</
AjaxSettings
>
</
telerik:RadAjaxManager
>
<
uc:BasicControl
id
=
"ProcedimentiDedicatiInTrattamentiGrid"
runat
=
"server"
Visible
=
"true"
OnNeedDataSource
=
"ProcedimentiDedicatiInTrattamentiGrid_NeedDataSource"
>
</
uc:BasicControl
>
<
table
>
<
tr
>
<
td
style
=
"width:20%"
>
<
telerik:RadListView
RenderMode
=
"Lightweight"
runat
=
"server"
ID
=
"RadListViewTrattamenti"
DataKeyNames
=
"Id"
AllowPaging
=
"true"
AllowCustomPaging
=
"true"
PageSize
=
"5"
ItemPlaceholderID
=
"TrattamentiHolder"
OnPageIndexChanged
=
"RadListViewTrattamenti_PageIndexChanged"
OnNeedDataSource
=
"RadListViewTrattamenti_NeedDataSource"
OnSelectedIndexChanged
=
"RadListViewTrattamenti_SelectedIndexChanged"
>
<
LayoutTemplate
>
<
fieldset
style
=
"display:inline-block"
>
<
legend
>Trattamenti</
legend
>
<
asp:Panel
ID
=
"TrattamentiHolder"
runat
=
"server"
></
asp:Panel
>
</
fieldset
>
</
LayoutTemplate
>
<
ItemTemplate
>
<
asp:LinkButton
runat
=
"server"
CommandName
=
"Select"
>
<%#Eval("Nome") %>
</
asp:LinkButton
>
<
br
/>
</
ItemTemplate
>
<
SelectedItemTemplate
>
<
asp:Label
runat
=
"server"
BackColor
=
"YellowGreen"
>
<%#Eval("Nome") %>
</
asp:Label
><
br
/>
</
SelectedItemTemplate
>
</
telerik:RadListView
>
</
td
>
<
td
style
=
"width:80%"
>
<
uc:BasicControl
id
=
"ProcedimentiInTrattamentiGrid"
runat
=
"server"
Visible
=
"true"
OnNeedDataSource
=
"ProcedimentiInTrattamentiGrid_NeedDataSource"
>
</
uc:BasicControl
>
</
td
>
</
tr
>
</
table
>
<
telerik:RadScriptBlock
ID
=
"RadListBoxScripts"
runat
=
"server"
>
<
script
type
=
"text/javascript"
>
function OnClientLoad(sender) {
var listBox = sender;
listBox.requestItems(listBox.get_items().get_count(), 10);
}
</
script
>
</
telerik:RadScriptBlock
>
<
telerik:RadScriptManager
ID
=
"RadScriptManager1"
runat
=
"server"
>
<
Scripts
>
<
asp:ScriptReference
Assembly
=
"Telerik.Web.UI"
Name
=
"Telerik.Web.UI.Common.Core.js"
/>
<
asp:ScriptReference
Assembly
=
"Telerik.Web.UI"
Name
=
"Telerik.Web.UI.Common.jQuery.js"
/>
<
asp:ScriptReference
Assembly
=
"Telerik.Web.UI"
Name
=
"Telerik.Web.UI.Common.jQueryInclude.js"
/>
</
Scripts
>
</
telerik:RadScriptManager
>
<
script
type
=
"text/javascript"
>
//Put your JavaScript code here.
</
script
>
</
div
>
</
form
>
</
body
>
</
html
>
So, ProcedimentiInTrattamentiGrid is updated, while ProcedimentiDedicatiInTrattamentiGrid is not.
What could be the problem?
The user controls are working, because if I select a new element in RadListViewTrattamenti, the ProcedimentiInTrattamentiGrid is updated with new values, ProcedimentiDedicatiInTrattamentiGrid no, but if I change the page it shows the new values, it seems the the NeedDataSource Event isn't fired for this one grid.
Thank you