I have the following code for displaying the tabs, on clicking the arow icon expands the child tabs but when I click on the text it refresh the page. I want it not to refresh the page when clicked on parent node.
I am new to ASP and infragistics any guidence would be much appresiated.
<ul class="navigation"><li class="rptHeading">Reports</li><li><ig:WebDataTree ID="WebDataTree1" runat="server" OnNodeClick="WebDataTree1_NodeClick" ViewStateMode="Enabled" EnableExpandOnClick="true"> <AutoPostBackFlags NodeClick="On" /> <Nodes> <ig:DataTreeNode Text="parent tab1"> <Nodes> <ig:DataTreeNode Text="child1" Value="child1"></ig:DataTreeNode> <ig:DataTreeNode Text="child2" Value="child2"></ig:DataTreeNode> </Nodes> </ig:DataTreeNode> <ig:DataTreeNode Text="Parent tab2"> <Nodes> <ig:DataTreeNode Text="child1" Value="child1"></ig:DataTreeNode> <ig:DataTreeNode Text="child2" Value="child2"></ig:DataTreeNode> </Nodes> </ig:DataTreeNode> </Nodes> </ig:WebDataTree></li></ul>
Thank you very much Alex,
it worked now
Said,
you need to add the client event to the WebDataTree:
...
<ClientEvents NodeClick="WebDataTree1_NodeClick" />
</ig:WebDataTree>
I removed this code <AutoPostBackFlags NodeClick="On" /> from index.aspx file and put the javascript code you provided in the footer of index.aspx now the page is not refreshing on clicking the parent node but it does nothing on clicking the child node as well.
Thank you for your response!
What I can suggest is to remove the AutoPostBack flag and to use the client "NodeClick" event. In this case, a postback will be executed only when a child node is clicked. And you will be able to pass the information you need to the server.
Here is an example for such an implementation:
<script type="text/javascript" id="igClientScript">
function WebDataTree1_NodeClick(sender, eventArgs)
{
if (!(eventArgs._props[0].target.classList.contains("igdt_NodeParent"))) {
__doPostBack(sender._id, "NodeClick" + (eventArgs._getPostArgs ? eventArgs._getPostArgs() : ''));
}
</script>
Please, let me know if this is not working for your scenario.
Regards,
Alexander
When someone click on the child tab I get the value of the clicked tab and getting the data from the db but on the parent tab I don't want to postback
switch (this.Label1.Text) { case "child1": AssignDataSource(gq.child1(some arguments), exportExcel); break; case "child2": AssignDataSource(gq.child2(some arguments), exportExcel); break;}