I'm using the panelbar, and allow for a choice between two different views (which change the contents in the panelbar).
Changing the view recreates the panelbar, but the buttons in it now require two clicks.(complete_Click only gets called on the second click.). To reproduce, set a breakpoint at complete_Click run the code, click on the "COMPLETE" button, verify that the breakpoint is hit with one click. They click on the top "Completed courses", view the "new" panelbar, try clicking on "COMPLETE" and see it require two clicks to hit the breakpoint.
My test.aspx code:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="test.aspx.cs" Inherits="test" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!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">
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server">
<asp:Button ID="newcourses" runat="server" Text="New Courses" onclick="newcourses_Click" />
<asp:Button ID="completedcourses" runat="server" Text="Completed Courses" onclick="completedcourses_Click" />
<asp:PlaceHolder ID="courseplaceholder" runat="server"></asp:PlaceHolder>
</telerik:RadAjaxPanel>
</div>
</form>
</body>
</html>
My test.aspx.cs code
using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Telerik.Web.UI;
using System.Data.SqlClient;
public partial class test : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Session["current"] == null)
{
Session["current"] = "True";
}
createPanelBar();
}
void createPanelBar()
{
courseplaceholder.Controls.Clear();
RadPanelBar coursepanels = new RadPanelBar();
coursepanels.ExpandMode = PanelBarExpandMode.SingleExpandedItem;
coursepanels.Skin = "Telerik";
RadPanelItem panelItem;
RadPanelItem panelSubItem;
TextBoxTemplate template;
panelItem = new RadPanelItem();
panelItem.Expanded = true;
panelItem.Text = "Grouping";
panelItem.ExpandedCssClass = "ExpandedCssClass";
panelSubItem = new RadPanelItem();
template = new TextBoxTemplate();
Literal text = new Literal();
if (Session["current"].ToString() == "True" )
{
text.Text = "Course to be taken ";
}
else
{
text.Text = "Already taken course ";
}
panelSubItem.Controls.Add(text);
Button button = new Button();
button.Text = "COMPLETE";
button.ID = "complete1";
button.Click += new EventHandler(complete_Click);
panelSubItem.Controls.Add(button);
template.InstantiateIn(panelSubItem);
panelItem.Items.Add(panelSubItem);
coursepanels.Items.Add(panelItem);
courseplaceholder.Controls.Add(coursepanels);
}
protected void newcourses_Click(object sender, EventArgs e)
{
Session["current"] = true;
createPanelBar();
}
protected void completedcourses_Click(object sender, EventArgs e)
{
Session["current"] = false;
createPanelBar();
}
void complete_Click(object sender, EventArgs e)
{
}
class TextBoxTemplate : ITemplate
{
public void InstantiateIn(Control container)
{
}
}
}
Changing the view recreates the panelbar, but the buttons in it now require two clicks.(complete_Click only gets called on the second click.). To reproduce, set a breakpoint at complete_Click run the code, click on the "COMPLETE" button, verify that the breakpoint is hit with one click. They click on the top "Completed courses", view the "new" panelbar, try clicking on "COMPLETE" and see it require two clicks to hit the breakpoint.
My test.aspx code:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="test.aspx.cs" Inherits="test" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!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">
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server">
<asp:Button ID="newcourses" runat="server" Text="New Courses" onclick="newcourses_Click" />
<asp:Button ID="completedcourses" runat="server" Text="Completed Courses" onclick="completedcourses_Click" />
<asp:PlaceHolder ID="courseplaceholder" runat="server"></asp:PlaceHolder>
</telerik:RadAjaxPanel>
</div>
</form>
</body>
</html>
My test.aspx.cs code
using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Telerik.Web.UI;
using System.Data.SqlClient;
public partial class test : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Session["current"] == null)
{
Session["current"] = "True";
}
createPanelBar();
}
void createPanelBar()
{
courseplaceholder.Controls.Clear();
RadPanelBar coursepanels = new RadPanelBar();
coursepanels.ExpandMode = PanelBarExpandMode.SingleExpandedItem;
coursepanels.Skin = "Telerik";
RadPanelItem panelItem;
RadPanelItem panelSubItem;
TextBoxTemplate template;
panelItem = new RadPanelItem();
panelItem.Expanded = true;
panelItem.Text = "Grouping";
panelItem.ExpandedCssClass = "ExpandedCssClass";
panelSubItem = new RadPanelItem();
template = new TextBoxTemplate();
Literal text = new Literal();
if (Session["current"].ToString() == "True" )
{
text.Text = "Course to be taken ";
}
else
{
text.Text = "Already taken course ";
}
panelSubItem.Controls.Add(text);
Button button = new Button();
button.Text = "COMPLETE";
button.ID = "complete1";
button.Click += new EventHandler(complete_Click);
panelSubItem.Controls.Add(button);
template.InstantiateIn(panelSubItem);
panelItem.Items.Add(panelSubItem);
coursepanels.Items.Add(panelItem);
courseplaceholder.Controls.Add(coursepanels);
}
protected void newcourses_Click(object sender, EventArgs e)
{
Session["current"] = true;
createPanelBar();
}
protected void completedcourses_Click(object sender, EventArgs e)
{
Session["current"] = false;
createPanelBar();
}
void complete_Click(object sender, EventArgs e)
{
}
class TextBoxTemplate : ITemplate
{
public void InstantiateIn(Control container)
{
}
}
}