couldn't find a more appropriate forum category...
button click seems to drop out when you add a dynically create button to a dynmically created pageview.
works ok if you add a dynamic button to an existing pageview.
is this an issue or am i doing it wrong?
code snippets follow...
thanks,
paul
p.s. if i add the button dynamically to the specific pageview "PV1" then the click works
protected void Page_Load(object sender, EventArgs e)
{
if (Session["counter"] != null)
{ counter = (int)Session["counter"]; }
Telerik.Web.UI.RadPageView newPageView = new Telerik.Web.UI.RadPageView();
newPageView.ID = "pv_" + counter.ToString();
newPageView.Visible = true;
MP1.PageViews.Add(newPageView);
MP1.SelectedIndex = MP1.FindPageViewByID(newPageView.ID).Index;
Telerik.Web.UI.RadTab newTab = new Telerik.Web.UI.RadTab();
newTab.Text = newPageView.ID;
newTab.Visible = true;
TS1.Tabs.Add(newTab);
TS1.SelectedIndex = TS1.FindTabByText(newTab.Text).Index;
System.Web.UI.WebControls.Button newButton = new System.Web.UI.WebControls.Button();
newButton.ID = "btn_" + counter.ToString();
newButton.Text = "Close Image";
newButton.Click += new EventHandler(btnRemoveFromList_Click);
newPageView.Controls.Add(newButton);
counter++;
Session["counter"] = counter;
}
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="TestCtrl.ascx.cs" Inherits="WebApplication2.TestCtrl" %>
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>
<link rel="Stylesheet" type="text/css" href="~/Styles/SiteX.css" id="style" runat="server" visible="false" />
<telerik:RadScriptManager ID="RadScriptManager1" runat="server">
</telerik:RadScriptManager>
<telerik:RadTabStrip ID="TS1" runat="server" SelectedIndex="0"
MultiPageID="MP1" Skin="Simple">
<Tabs>
<telerik:RadTab runat="server" Text="Search">
</telerik:RadTab>
</Tabs>
</telerik:RadTabStrip>
<telerik:RadMultiPage ID="MP1" Runat="server" SelectedIndex="0"
Width="100%" BorderColor="Black" BorderStyle="Solid" BorderWidth="1px">
<telerik:RadPageView ID="PV1" runat="server">
</telerik:RadPageView>
</telerik:RadMultiPage>
button click seems to drop out when you add a dynically create button to a dynmically created pageview.
works ok if you add a dynamic button to an existing pageview.
is this an issue or am i doing it wrong?
code snippets follow...
thanks,
paul
p.s. if i add the button dynamically to the specific pageview "PV1" then the click works
protected void Page_Load(object sender, EventArgs e)
{
if (Session["counter"] != null)
{ counter = (int)Session["counter"]; }
Telerik.Web.UI.RadPageView newPageView = new Telerik.Web.UI.RadPageView();
newPageView.ID = "pv_" + counter.ToString();
newPageView.Visible = true;
MP1.PageViews.Add(newPageView);
MP1.SelectedIndex = MP1.FindPageViewByID(newPageView.ID).Index;
Telerik.Web.UI.RadTab newTab = new Telerik.Web.UI.RadTab();
newTab.Text = newPageView.ID;
newTab.Visible = true;
TS1.Tabs.Add(newTab);
TS1.SelectedIndex = TS1.FindTabByText(newTab.Text).Index;
System.Web.UI.WebControls.Button newButton = new System.Web.UI.WebControls.Button();
newButton.ID = "btn_" + counter.ToString();
newButton.Text = "Close Image";
newButton.Click += new EventHandler(btnRemoveFromList_Click);
newPageView.Controls.Add(newButton);
counter++;
Session["counter"] = counter;
}
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="TestCtrl.ascx.cs" Inherits="WebApplication2.TestCtrl" %>
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>
<link rel="Stylesheet" type="text/css" href="~/Styles/SiteX.css" id="style" runat="server" visible="false" />
<telerik:RadScriptManager ID="RadScriptManager1" runat="server">
</telerik:RadScriptManager>
<telerik:RadTabStrip ID="TS1" runat="server" SelectedIndex="0"
MultiPageID="MP1" Skin="Simple">
<Tabs>
<telerik:RadTab runat="server" Text="Search">
</telerik:RadTab>
</Tabs>
</telerik:RadTabStrip>
<telerik:RadMultiPage ID="MP1" Runat="server" SelectedIndex="0"
Width="100%" BorderColor="Black" BorderStyle="Solid" BorderWidth="1px">
<telerik:RadPageView ID="PV1" runat="server">
</telerik:RadPageView>
</telerik:RadMultiPage>