I have a project I've converted from 13.1 to 15.2. The project would update an item in a group to 'Selected' in PreRender, and worked fine in 13.1. In 15.2, setting the selected property to true has no effect in PreRender.
Here's the code to recreate the issue. If you uncomment the code in Page_Load, the item gets selected, and it's text gets updated with 'updated' as expected. Same code in form1 PreRender or WebExplorerBar1 PreRender has no effect.
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="WebForm1.aspx.vb" Inherits="WebApplication1.WebForm1" %>
<%@ Register Assembly="Infragistics45.Web.v15.2, Version=15.2.20152.1028, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" Namespace="Infragistics.Web.UI.NavigationControls" TagPrefix="ig" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<ig:WebExplorerBar ID="WebExplorerBar1" runat="server" Width="250px">
<Groups>
<ig:ExplorerBarGroup Text="Folders">
<Items>
<ig:ExplorerBarItem Text="Documents" />
<ig:ExplorerBarItem Text="Samples" />
</Items>
</ig:ExplorerBarGroup>
<ig:ExplorerBarGroup Text="Drives">
<ig:ExplorerBarItem Text="C:" />
<ig:ExplorerBarItem Text="D:" />
<ig:ExplorerBarGroup Text="Miscellaneous">
<ig:ExplorerBarItem Text="Worksheet.xls" />
<ig:ExplorerBarItem Text="Pic.png" />
</Groups>
</ig:WebExplorerBar>
</div>
</form>
</body>
</html>
Imports Infragistics.Web.UI.NavigationControls
Public Class WebForm1
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
'WebExplorerBar1.Groups(0).Selected = True
'WebExplorerBar1.Groups(0).Expanded = True
'WebExplorerBar1.Groups(0).Items(1).Selected = True
'WebExplorerBar1.Groups(0).Items(1).Text = "Updated"
End Sub
Private Sub form1_PreRender(sender As Object, e As EventArgs) Handles form1.PreRender
WebExplorerBar1.Groups(0).Selected = True
WebExplorerBar1.Groups(0).Expanded = True
WebExplorerBar1.Groups(0).Items(1).Selected = True
WebExplorerBar1.Groups(0).Items(1).Text = "Updated"
Private Sub WebExplorerBar1_PreRender(sender As Object, e As EventArgs) Handles WebExplorerBar1.PreRender
End Class
This worked fine in 13.1, but no longer works in 15.2. Is this a bug, or has the behavior changed for this control?
Thanks.
Hello,
Have you by any chance previously defined the Groups and items in the PreRender event?
I have tested this on the latest 13.1 and 15.2 versions of the product and the results are exactly the same: Using v13.1, Version=13.1.20131.2331 and 15.2.20152.1028:
Initially, when loading the page PreRender event settings are ignored for both the Static and dynamic groups and items. On PostBack however, the PreRender event settings are respected and overriding the Page_Load settings (assuming you are using this event to create/set the Groups and Items). On the other hand however, if the Group and Items are created in the PreRender event itself, the item collections (selected, expanded, text, etc.) are correctly applied. In case it is a must for you to handle WebExplorerBar_PreRender, I suggest you to create the relevant groups and items in the same PreRender event.
Please let me know how my suggestions work for you.
Hi Ivaylo,
I am using the following versions: 13.1.20131.1012 and 15.2.20152.1028.
My actual project dynamically loads the control in Page_Load and updates the selected item in Page_PreRender. I went back and changed my sample to work in this manner (seen below). In 13.1, my item is selected when coded in PreRender. In 15.2, my item is not selected when coded in PreRender.
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="WebForm2.aspx.vb" Inherits="WebApplication2.WebForm2" %>
Public Class WebForm2
' Group 1
Dim group As New ExplorerBarGroup()
group.Text = "Folders"
Me.WebExplorerBar1.Groups.Add(group)
Dim item As New ExplorerBarItem()
item.Text = "Documents"
group.Items.Add(item)
item = New ExplorerBarItem()
item.Text = "Samples"
' Group 2
group = New ExplorerBarGroup()
group.Text = "Drives"
item.Text = "C:"
item.Text = "D:"
From this example, we can see the behavior has changed between 13.1 and 15.2 for a dynamically loaded control in Page_Load, and then updated in PreRender. The changes in PreRender are ignored in 15.2.
I was able to work around the problem in 15.2 by moving my selection logic out of the PreRender event.
Thanks