[LEFT][LEFT]I have a tree view along with other button controls in my custom composite control. Here is the code for my custom web control

public class ICDTreeControl : CompositeControl, INamingContainer

{

protected Button AddBtn;

protected TreeView ICDTreeView;

protected virtual void CreateControlHierarchy()

{

// Creating a button control

AddBtn = new Button();

AddBtn.ID = "AddBtn";

AddBtn.Text = "Add";

AddBtn.CssClass = "ButtonStyle";

AddBtn.Click += new EventHandler(this.OnClick_AddBtn);

AddBtn.Enabled = false;

// Creating a Tree View control

ICDTreeView = new TreeView();

ICDTreeView.ID = "ICDTreeView";

ICDTreeView.CssClass = "ICDTree";
ICDTreeView.PopulateNodesFromClient = true;
ICDTreeView.EnableClientScript = true;
ICDTreeView.Enabled = true;
ICDTreeView.Visible = true;


// Event handler to dynamically populate the tree nodes

ICDTreeView.TreeNodePopulate += new TreeNodeEventHandler (this.OnTreeNodePopulate);

ICDTreeView.SelectedNodeChanged += new EventHandler (this.OnSelectedNodeChanged);

this.Controls.Add(ICDTreeView);

this.Controls.Add(AddBtn);

}



protected override void Render(HtmlTextWriter writer)

{

ICDTreeView.RenderControl(writer);

// Add a line

writer.RenderBeginTag(HtmlTextWriterTag.Br);

writer.RenderEndTag();


AddBtn.RenderControl(writer);

}



protected virtual void OnTreeNodePopulate(object sender, System.Web.UI.WebControls.TreeNodeEventArgs e)

{

// contains code that populates the nodes dynamically when the user clicks on expand/collapse links.

}

}

--------------------------------------------------------------------------

When the asp page is loaded, the tree view is not being rendered on the page. Could you please take a look at the page source below and see if you can find anything wrong ? Thanks !


<!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><title>
Untitled Page
</title><link rel="stylesheet" href="look2.css" type="text/css" /><style type="text/css">
.ctl00_DeviceImplantContent_ICDTree1_ICDTreeView_0 { text-decoration:none; }
.ctl00_DeviceImplantContent_ICDTree1_ICDTreeView_1 { background-color:LightGrey; }

</style></head>

<body>
<form name="aspnetForm" method="post" action="IndicationsForProc.aspx" id="aspnetForm">
<div>
<input type="hidden" name="ctl00_DeviceImplantContent_ICDTree1_ICDTreeView_ExpandState" id="ctl00_DeviceImplantContent_ICDTree1_ICDTreeView_ExpandState" value="" />
<input type="hidden" name="ctl00_DeviceImplantContent_ICDTree1_ICDTreeView_SelectedNode" id="ctl00_DeviceImplantContent_ICDTree1_ICDTreeView_SelectedNode" value="" />
<input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" />
<input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" />
<input type="hidden" name="ctl00_DeviceImplantContent_ICDTree1_ICDTreeView_PopulateLog" id="ctl00_DeviceImplantContent_ICDTree1_ICDTreeView_PopulateLog" value="" />
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwULLTE3MzE5NzM1MDgPZBYCZg9kFgICAw9kFgICAw9kFgICAQ9kFgJmDzwrAAkBAA8WBh4NTmV2ZXJFeHBhbmR lZGQeDFNlbGVjdGVkTm9kZWQeCUxhc3RJbmRleGZkZBgBBR5fX0NvbnRyb2xzUmVxdWlyZVBvc3RCYWNrS2V5X18WA QUvY3RsMDAkRGV2aWNlSW1wbGFudENvbnRlbnQkSUNEVHJlZTEkSUNEVHJlZVZpZXfXZ2oAX8Q84rfzJkAVXiHRVRO 0kw==" />
</div>

<script type="text/javascript">
<!--
var theForm = document.forms['aspnetForm'];
if (!theForm) {
theForm = document.aspnetForm;
}
function __doPostBack(eventTarget, eventArgument) {
if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
theForm.__EVENTTARGET.value = eventTarget;
theForm.__EVENTARGUMENT.value = eventArgument;
theForm.submit();
}
}
// -->
</script>


<script src="/Discc.Apps.ICDTree/WebResource.axd?d=fv_sZ-pCkDQBMEijyQDhmg2&t=632690483094637921" type="text/javascript"></script>


<script src="/Discc.Apps.ICDTree/WebResource.axd?d=na_PKYZYPOzl1-E1nxr6Lw2&t=632690483094637921" type="text/javascript"></script>
<script>
<!--
function TreeView_PopulateNodeDoCallBack(context,param) {
WebForm_DoCallback(context.data.treeViewID,param,TreeView_ProcessNodeData,context,TreeView _ProcessNodeData,false);
}
// -->
</script>


<table>
<tr>
<td>
<img id="ctl00_EPimage" src="H:/srini005/EP/DeviceImplant/images/discc_ep.gif" style="border-width:0px;" />
</td>
</tr>
</table>


<div>


<a href="#ctl00_DeviceImplantContent_ICDTree1_ICDTreeView_SkipLink"><img alt="Skip Navigation Links." src="/Discc.Apps.ICDTree/WebResource.axd?d=tAl8mLVx3mVRyPFJ_86RZA2&t=632690483094637921" width="0" height="0" style="border-width:0px;" /></a><div id="ctl00_DeviceImplantContent_ICDTree1_ICDTreeView" class="ICDTree">

</div><a id="ctl00_DeviceImplantContent_ICDTree1_ICDTreeView_SkipLink"></a>


</br><input type="submit" name="ctl00$DeviceImplantContent$ICDTree1$AddBtn" value="Add" id="ctl00_DeviceImplantContent_ICDTree1_AddBtn" disabled="disabled" class="ButtonStyle" />


</div>


<script type="text/javascript">
<!--
var ctl00_DeviceImplantContent_ICDTree1_ICDTreeView_ImageArray = new Array('', '', '', '/Discc.Apps.ICDTree/WebResource.axd?d=bUHJ6Lyk_v3bJgX3vkPbF7Xt9kxM8fNR_tWgdK9RKDU1&t=632690483094637921', '/Discc.Apps.ICDTree/WebResource.axd?d=bUHJ6Lyk_v3bJgX3vkPbFz9LF1LVQi2cEiiGFaM4dvw1&t=632690483094637921', '/Discc.Apps.ICDTree/WebResource.axd?d=bUHJ6Lyk_v3bJgX3vkPbF38hdaGLzC76gJb-t9ZvJno1&t=632690483094637921');
// -->
</script>

<div>

<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWAgLZ97a5BgKf5sSSA6NFfA5bSfA7+eDqMB06k5HBAcyf" />
</div>

<script type="text/javascript">
<!--

WebForm_InitCallback();var ctl00_DeviceImplantContent_ICDTree1_ICDTreeView_Data = new Object();
ctl00_DeviceImplantContent_ICDTree1_ICDTreeView_Data.images = ctl00_DeviceImplantContent_ICDTree1_ICDTreeView_ImageArray;
ctl00_DeviceImplantContent_ICDTree1_ICDTreeView_Data.collapseToolTip = "Collapse {0}";
ctl00_DeviceImplantContent_ICDTree1_ICDTreeView_Data.expandToolTip = "Expand {0}";
ctl00_DeviceImplantContent_ICDTree1_ICDTreeView_Data.expandState = theForm.elements['ctl00_DeviceImplantContent_ICDTree1_ICDTreeView_ExpandState'];
ctl00_DeviceImplantContent_ICDTree1_ICDTreeView_Data.selectedNodeID = theForm.elements['ctl00_DeviceImplantContent_ICDTree1_ICDTreeView_SelectedNode'];
ctl00_DeviceImplantContent_ICDTree1_ICDTreeView_Data.selectedClass = 'ctl00_DeviceImplantContent_ICDTree1_ICDTreeView_1 ';
ctl00_DeviceImplantContent_ICDTree1_ICDTreeView_Data.selectedHyperLinkClass = ' ';
for (var i=0;i<6;i++) {
var preLoad = new Image();
if (ctl00_DeviceImplantContent_ICDTree1_ICDTreeView_ImageArray[i].length > 0)
preLoad.src = ctl00_DeviceImplantContent_ICDTree1_ICDTreeView_ImageArray[i];
}
ctl00_DeviceImplantContent_ICDTree1_ICDTreeView_Data.lastIndex = 0;
ctl00_DeviceImplantContent_ICDTree1_ICDTreeView_Data.populateLog = theForm.elements['ctl00_DeviceImplantContent_ICDTree1_ICDTreeView_PopulateLog'];
ctl00_DeviceImplantContent_ICDTree1_ICDTreeView_Data.treeViewID = 'ctl00$DeviceImplantContent$ICDTree1$ICDTreeView';
ctl00_DeviceImplantContent_ICDTree1_ICDTreeView_Data.name = 'ctl00_DeviceImplantContent_ICDTree1_ICDTreeView_Data';
// -->
</script>
</form>
</body>
</html>