I have a RadListView nested within a RadListView. The inner RadListView has LinkButtons for copying/deleting/organizing the elements. When the LinkButtons are clicked, the events fire and I copy/delete/reorganize the data, but the page doesn't get updated. If I refresh the page or execute another command, the data is refreshed...but it's always one click behind. It's obviously an event sequence and after lots of searching it sounds like I need to use the AjaxManager. I've been wresting with this too long and need help.
ASPX
I included surrounding controls just in case this affected the solution. The issues I'm having are with rlvGroups,
<telerik:RadMultiPage ID="rmpTabs" runat="server" SelectedIndex="0" Width="100%">
<telerik:RadPageView ID="rpv1" runat="server">
Page title: <asp:TextBox ID="txtTitle" runat="server"></asp:TextBox>
</telerik:RadPageView>
<telerik:RadPageView ID="rpv2" runat="server">
<asp:Panel ID="pnlNotRelevant" runat="server">
</asp:Panel>
</telerik:RadPageView>
<telerik:RadPageView ID="rpv4" runat="server">
<asp:Panel ID="pnlItems" runat="server">
<telerik:RadListView ID="rlvGroups" runat="server" OnItemDataBound="rlvGroups_ItemDataBound"
Width="100%">
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "Name")%>
<br />
<telerik:RadListView ID="rlvItems" runat="server" OnItemDataBound="rlvItems_ItemDataBound"
Width="100%">
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "Title")%>
<asp:LinkButton ID="lbUp" runat="server" OnCommand="lbUp_Command"><img src="arrow-up.png" /></asp:LinkButton>
<asp:LinkButton ID="lbDown" runat="server" OnCommand="lbDown_Command"><img src="arrow-down.png" /></asp:LinkButton>
<asp:LinkButton ID="lbEdit" runat="server" OnCommand="lbEdit_Command"><img src="edit.jpg" /></asp:LinkButton>
<asp:LinkButton ID="lbCopy" runat="server" OnCommand="lbCopy_Command"><img src="copy.jpg" /></asp:LinkButton>
<asp:LinkButton ID="lbDelete" runat="server" OnCommand="lbDelete_Command"><img src="delete.png" /></asp:LinkButton>
</ItemTemplate>
</telerik:RadListView>
<asp:LinkButton ID="lbAddPage" runat="server" Text="Add Page" OnCommand="lbAddPage_Command" />
<br />
<br />
</ItemTemplate>
</telerik:RadListView>
<asp:LinkButton ID="lbAddGroup" runat="server" Text="Add Group" OnCommand="lbAddGroup_Command" />
</asp:Panel>
</telerik:RadPageView>
</telerik:RadMultiPage>
C#
Data is loaded from custom classes:
private void RefreshGroupsItems()
{
rlvGroups.DataSource = tab.ViewX.Groups.Group;
rlvGroups.DataBind();
}
protected void rlvGroups_ItemDataBound(object sender, RadListViewItemEventArgs e)
{
if (e.Item.ItemType == RadListViewItemType.DataItem || e.Item.ItemType == RadListViewItemType.AlternatingItem)
{
//Get datarow
Group group = (Group)(((RadListViewDataItem)e.Item).DataItem);
//Find controls
RadListView rlvItems = (RadListView)e.Item.FindControl("rlvItems");
LinkButton lbAddPage = (LinkButton)e.Item.FindControl("lbAddPage");
//Populate controls
List<ListItem> data = DataHelpers.BuildListItem(group);
rlvItems.DataSource = data;
rlvItems.DataBind();
lbAddPage.CommandArgument = group.ID.ToString();
}
}
protected void rlvItems_ItemDataBound(object sender, RadListViewItemEventArgs e)
{
if (e.Item.ItemType == RadListViewItemType.DataItem || e.Item.ItemType == RadListViewItemType.AlternatingItem)
{
//Get datarow
ListItem item = (ListItem)(((RadListViewDataItem)e.Item).DataItem);
//Find controls
LinkButton lbUp = (LinkButton)e.Item.FindControl("lbUp");
LinkButton lbDown = (LinkButton)e.Item.FindControl("lbDown");
LinkButton lbEdit = (LinkButton)e.Item.FindControl("lbEdit");
LinkButton lbCopy = (LinkButton)e.Item.FindControl("lbCopy");
LinkButton lbDelete = (LinkButton)e.Item.FindControl("lbDelete");
//Populate controls
lbUp.CommandArgument = item.ID.ToString();
lbDown.CommandArgument = item.ID.ToString();
lbEdit.CommandArgument = item.ID.ToString();
lbCopy.CommandArgument = item.ID.ToString();
lbDelete.CommandArgument = item.ID.ToString();
}
}
Please help!
ASPX
I included surrounding controls just in case this affected the solution. The issues I'm having are with rlvGroups,
<telerik:RadMultiPage ID="rmpTabs" runat="server" SelectedIndex="0" Width="100%">
<telerik:RadPageView ID="rpv1" runat="server">
Page title: <asp:TextBox ID="txtTitle" runat="server"></asp:TextBox>
</telerik:RadPageView>
<telerik:RadPageView ID="rpv2" runat="server">
<asp:Panel ID="pnlNotRelevant" runat="server">
</asp:Panel>
</telerik:RadPageView>
<telerik:RadPageView ID="rpv4" runat="server">
<asp:Panel ID="pnlItems" runat="server">
<telerik:RadListView ID="rlvGroups" runat="server" OnItemDataBound="rlvGroups_ItemDataBound"
Width="100%">
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "Name")%>
<br />
<telerik:RadListView ID="rlvItems" runat="server" OnItemDataBound="rlvItems_ItemDataBound"
Width="100%">
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "Title")%>
<asp:LinkButton ID="lbUp" runat="server" OnCommand="lbUp_Command"><img src="arrow-up.png" /></asp:LinkButton>
<asp:LinkButton ID="lbDown" runat="server" OnCommand="lbDown_Command"><img src="arrow-down.png" /></asp:LinkButton>
<asp:LinkButton ID="lbEdit" runat="server" OnCommand="lbEdit_Command"><img src="edit.jpg" /></asp:LinkButton>
<asp:LinkButton ID="lbCopy" runat="server" OnCommand="lbCopy_Command"><img src="copy.jpg" /></asp:LinkButton>
<asp:LinkButton ID="lbDelete" runat="server" OnCommand="lbDelete_Command"><img src="delete.png" /></asp:LinkButton>
</ItemTemplate>
</telerik:RadListView>
<asp:LinkButton ID="lbAddPage" runat="server" Text="Add Page" OnCommand="lbAddPage_Command" />
<br />
<br />
</ItemTemplate>
</telerik:RadListView>
<asp:LinkButton ID="lbAddGroup" runat="server" Text="Add Group" OnCommand="lbAddGroup_Command" />
</asp:Panel>
</telerik:RadPageView>
</telerik:RadMultiPage>
C#
Data is loaded from custom classes:
private void RefreshGroupsItems()
{
rlvGroups.DataSource = tab.ViewX.Groups.Group;
rlvGroups.DataBind();
}
protected void rlvGroups_ItemDataBound(object sender, RadListViewItemEventArgs e)
{
if (e.Item.ItemType == RadListViewItemType.DataItem || e.Item.ItemType == RadListViewItemType.AlternatingItem)
{
//Get datarow
Group group = (Group)(((RadListViewDataItem)e.Item).DataItem);
//Find controls
RadListView rlvItems = (RadListView)e.Item.FindControl("rlvItems");
LinkButton lbAddPage = (LinkButton)e.Item.FindControl("lbAddPage");
//Populate controls
List<ListItem> data = DataHelpers.BuildListItem(group);
rlvItems.DataSource = data;
rlvItems.DataBind();
lbAddPage.CommandArgument = group.ID.ToString();
}
}
protected void rlvItems_ItemDataBound(object sender, RadListViewItemEventArgs e)
{
if (e.Item.ItemType == RadListViewItemType.DataItem || e.Item.ItemType == RadListViewItemType.AlternatingItem)
{
//Get datarow
ListItem item = (ListItem)(((RadListViewDataItem)e.Item).DataItem);
//Find controls
LinkButton lbUp = (LinkButton)e.Item.FindControl("lbUp");
LinkButton lbDown = (LinkButton)e.Item.FindControl("lbDown");
LinkButton lbEdit = (LinkButton)e.Item.FindControl("lbEdit");
LinkButton lbCopy = (LinkButton)e.Item.FindControl("lbCopy");
LinkButton lbDelete = (LinkButton)e.Item.FindControl("lbDelete");
//Populate controls
lbUp.CommandArgument = item.ID.ToString();
lbDown.CommandArgument = item.ID.ToString();
lbEdit.CommandArgument = item.ID.ToString();
lbCopy.CommandArgument = item.ID.ToString();
lbDelete.CommandArgument = item.ID.ToString();
}
}
Please help!