I am trying to develop a page with a rad tree within the left pane of a splitter and when a node is clicked I want to add a control (ascx) programatically to the right pane. It works, but when the edit button is clicked in the right pane's control, the postback happens, but the dynamically loaded control that was in the right pane does not get the postback.
The enable view state is set to true in the splitter, but nothing happens. I have examined the controls collection on the post back in question and the control I am loading dynamically is not there.
Here is the page with the splitter:
Here is the Control (ascx) in question:
The string in the lkbEdit_Click method is where I would expect that the postback in question would stop on a breakpoint, when I set one there. It does not. Rad Pane 2 is the pane I am having the issue with.
Thanks!!
The enable view state is set to true in the splitter, but nothing happens. I have examined the controls collection on the post back in question and the control I am loading dynamically is not there.
Here is the page with the splitter:
public partial class components_NorViewer : System.Web.UI.UserControl |
{ |
protected void Page_Load(object sender, EventArgs e) |
{ |
if (!Page.IsPostBack) |
{ |
string rootFolder = Server.MapPath("~/NORs"); |
RadTreeNode rootNode = new RadTreeNode(Path.GetFileName(rootFolder)); |
rootNode.ImageUrl = "~/images/folder.gif"; |
rootNode.Expanded = true; |
RadTreeView1.Nodes.Add(rootNode); |
BindTreeToDirectory(rootFolder, rootNode); |
} |
} |
private void BindTreeToDirectory(string dirPath, RadTreeNode parentNode) |
{ |
string[] directories = Directory.GetDirectories(dirPath); |
foreach (string directory in directories) |
{ |
RadTreeNode node = new RadTreeNode(Path.GetFileName(directory)); |
node.ImageUrl = "~/images/folder.gif"; |
parentNode.Nodes.Add(node); |
BindTreeToDirectory(directory, node); |
} |
string[] files = Directory.GetFiles(dirPath); |
foreach (string file in files) |
{ |
RadTreeNode node = new RadTreeNode(Path.GetFileNameWithoutExtension(file)); |
node.ImageUrl = "~/images/new.gif"; |
node.ToolTip = "Click to Load Groups of this NOR"; |
parentNode.Nodes.Add(node); |
} |
} |
protected void NodeClick(object sender, RadTreeNodeEventArgs e) |
{ |
switch (e.Node.Level) |
{ |
case 1: |
components_NorDetail uc1 = (components_NorDetail) Page.LoadControl("~/components/NorDetail.ascx"); |
uc1.FileName = "~/NORs/" + e.Node.Text + ".xml"; |
RadPane2.Controls.Add(uc1); |
BuildNorSectionNodes(e.Node.Text, e.Node); |
break; |
case 2: |
Control uc = Page.LoadControl("~/components/NorSection.ascx"); |
RadPane2.Controls.Add(uc); |
break; |
} |
} |
private void BuildNorSectionNodes(string strfile, RadTreeNode parentNode) |
{ |
DataSet ds = new DataSet(); |
ds.ReadXml(Server.MapPath("~/NORs/" + strfile+".xml")); |
foreach (DataRow dr in ds.Tables["sectiongroup"].Rows) |
{ |
RadTreeNode node = new RadTreeNode(dr["sectiongroupnumber"].ToString()+" "+dr["sectiongrouptext"].ToString()); |
node.ImageUrl = "~/images/new.gif"; |
node.ToolTip = "Click to Load Sections of this Group"; |
node.Expanded = true; |
parentNode.Nodes.Add(node); |
} |
parentNode.Expanded = true; |
} |
} |
Here is the Control (ascx) in question:
public partial class components_NorDetail : System.Web.UI.UserControl |
{ |
private string strFileName; |
public string FileName |
{ |
set { strFileName = value; } |
get { return this.strFileName; } |
} |
protected void Page_Load(object sender, EventArgs e) |
{ |
DataSet ds = new DataSet(); |
ds.ReadXml(Server.MapPath(FileName)); |
litDate.Text = ds.Tables["NOR"].Rows[0]["date"].ToString(); |
litDesc.Text = ds.Tables["NOR"].Rows[0]["desc"].ToString(); |
litTitle.Text = ds.Tables["NOR"].Rows[0]["title"].ToString(); |
litUpdated.Text = ds.Tables["NOR"].Rows[0]["updated"].ToString(); |
} |
protected void lkbEdit_Click(object sender, EventArgs e) |
{ |
string strtest = string.Empty; |
} |
} |
The string in the lkbEdit_Click method is where I would expect that the postback in question would stop on a breakpoint, when I set one there. It does not. Rad Pane 2 is the pane I am having the issue with.
Thanks!!