I am facing issue with regards to the TreeView
control. I have checkbox enabled for nodes of TreeView
control. It is working fine and showing properly. But when I deploy same to IIS, checkbox is not visible there. It is not rendered at all. Below is the TreeView
:
<asp:TreeView id="tvExplicit" EnableClientScript="true" PopulateNodesFromClient="true" ExpandDepth="0" ShowLines="true" ShowExpandCollapse="true" ShowCheckBoxes="Root" OnTreeNodePopulate="tvExplicit_TreeNodePopulate" Width="1px" runat="server"> <Nodes> </Nodes> </asp:TreeView>
This code is working fine on my local machine. But not when deployed on IIS. Everything works except showing checkboxes for root nodes.
Note: Checkboxes are not rendered as HTML at all. So it is not CSS blocking it as per me
Update : I was able to figure out that previous version of the page is cached in IIS and not being reset even after APP pool was reset.
2nd Update: Client Id of checkboxes in localhost is ctl00_MainContent_tvExplicitn0CheckBox
, ctl00_MainContent_tvExplicitn1CheckBox
,etc. So can it be the reason of the issue. One more thing that I noticed is the difference in client ID's generated for the controls in localhost and in server deployed to IIS. Below is the rendered <a>
which is part of treeview control in both:
MainContent_tvExplicitt0
,MainContent_tvExplicitt1
this is ID of treeview node linkctl00_MainContent_tvExplicitt0
,ctl00_MainContent_tvExplicitt2
,etcSo can the issue be related to how controls are actually being rendered in different environments viz my localhost and IIS server. In localhost, .Net 3.5 framework
is there and in IIS server .Net 4
. So can it be due to this as client ID
generation is different in both versions.
3rd Update Also, I changed framework version to .net 4
in localhost
, but it didn't reproduce the issue.It also did add controlRenderingCompatibilityVersion="3.5"
in web.config. Then I deployed same code to IIS, and I got an error that controlRenderingCompatibilityVersion
is not a valid tag. Does it mean IIS
server is not running on .net 4
.I don't have access to IIS server myself.
4th Update: Application is configured with .net 4
version in IIS.
5th Update I deployed same build to another IIS server on different machines(these were our old servers on which our application was running). And checkboxes are visible on that. Version of .net framework is same as that on the one facing issues. Asked the relevant team to update same settings as in these servers to servers on which are facing issue. Still it didnt help. So, it does seem to be issue with how website is configured on new servers where checkboxes are not visible
In order to display check boxes beside nodes in TreeView, set the CheckBoxes property of the C1TreeView class to True. The following code snippet sets the CheckBoxes property. The check box next to a node can be checked by setting the Checked property of C1TreeNode to True.
A typical tree structure has only one root node; however, you can add multiple root nodes to the TreeView control. The Nodes property can also be used to manage the root nodes in the tree programmatically. You can add, insert, remove, and retrieve TreeNode objects from the collection.
To search for a node in TreeView, you can use Search or SearchAll method of C1TreeView class. The Search method takes string as a value, searches for the nodes using depth-first search and returns the node containing the searched string.
Not an answer yet, needed to show the images, well I tried the same, used this code in aspx: (I did not change any setting in IIS, nothing in aspx as well, created a plain solution >> added the treeview and deployed.)
<asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server"> <div> <asp:TreeView ID="TreeTest" EnableClientScript="true" PopulateNodesFromClient="true" ExpandDepth="0" ShowLines="true" ShowExpandCollapse="true" ShowCheckBoxes="Root" OnTreeNodePopulate="TreeTest_TreeNodePopulate" Width="1px" runat="server"> <Nodes> <asp:TreeNode Text="Something"> <asp:TreeNode Text="11"></asp:TreeNode> </asp:TreeNode> <asp:TreeNode Text="Something"> <asp:TreeNode Text="11"></asp:TreeNode> </asp:TreeNode> <asp:TreeNode Text="Something"></asp:TreeNode> </Nodes> </asp:TreeView> </div> </asp:Content>
Checked in my local could see this:
Deployed in IIS version 6.2 , windows server 2012, could see this:
There must be something else which is preventing the checkboxes in your page. Show more code.
Sometimes IIS is configured for a different version of IE than your local version, this could cause some compatibility issues.
I always add the following to my head element in my html files:
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
There is more info here:
https://msdn.microsoft.com/en-us/library/jj676913(v=vs.85).aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With