none
Page.ISPostBack is not working in sharepoint site.

    Question

  • Hi,
    I have created an user control in .net and i am using it in sharepoint site.
    I am populating the treeview in that control . i have added that user control in the master page of the sharepoint site.

    But now the problem is i am getting Page.IsPostBack always false. Because of this treeview is getting loaded on every postback ,so i am not able to retrive the selected node for the second time..

    <%@ Control Language="C#" AutoEventWireup="true" >
    <script runat="server">
     protected void PageLoad(Object sender, Eventargs e)
     {
          if(!Page.IsPostBack)
           {
               // code to bind the data to treeview........
           }
     }
    <script>

    Please anyone tell me how to avoid this method call on paost back


    Monday, August 03, 2009 1:48 PM

All replies

  • IsPostBack works in SharePoint. Make sure the AutoPostBack property of your user control is set to true.


    SSA - http://sharepointblogs.com/ssa
    Monday, August 03, 2009 2:01 PM
  • Thanks for the reply..... However i have set the AutoPostBack Property to true. Still the same issue i am finding.........
    As i mentioned earlier i am using an user control, i have placed the user control in the control templates folder
    and through the sharepoint designer i have added below tags in the master page


    <%@ Register TagPrefix="menu" TagName="menuControl" src="~/_controltemplates/TreeView.ascx" %> 

     
    <menu:menuControl id="controls" runat="server" ></menu:menuControl>


    Now if i click on any of the child node which points to some other page which contains the same master page. then the tree view is getting binded again.....
    EX:
    Initially the tree structure looks like below

    +Root1
    +Root2
    however treeview structure is as below.

    -Root1
       child1
       child2
    -Root2
       child1
       child2

    if i click on child 1 of Root1 then i can see the treeview like below

    +Root1
    +Root2



    Tuesday, August 04, 2009 10:44 AM