Click here to Skip to main content
15,879,239 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
i have used the devexpress components in my ASP application . in page _load() i have bind the ASPXtreelist & initialize at page_init . but when i will focused to the particular node then page refresh automatically . same this will happened with ASPxMenu item click event.bothe event bind the gridview datasource. these all control placed in ASPxsplitter.i will try to solve using updatepanel but hole updatepanel get refresh. how to avoid the page refresh after event?
Refresh Page Issue in ASP.Net
i try above link solution also ...

 protected void Page_Load(object sender, EventArgs e)
    {
    
        if (!Page.IsPostBack)
        {
          
            Session["update"] = Server.UrlEncode(System.DateTime.Now.ToString());
          
            treeviewer.DataBind();
            
            BatchGV.ClientVisible = false;
            pnlreports.Visible = false;
        }
    }
protected override void OnInit(EventArgs e)
    {
                  base.OnInit(e);
                         InitTreeList(treeviewer);
              }

  void InitTreeList(ASPxTreeList tl)
    {                
            tl.KeyFieldName = "unit_id";
            tl.ParentFieldName = "unit_parent_id";
            tl.DataSource = loadtree();   
        
    }
protected void treeviewer_FocusedNodeChanged(object sender, EventArgs e)
    {
       //get column information
    }
   protected void ASPxMenu1_ItemClick(object source, DevExpress.Web.ASPxMenu.MenuItemEventArgs e)
    {
       // DevExpress.Web.ASPxMenu.MenuItemEventArgs eventarg = (DevExpress.Web.ASPxMenu.MenuItemEventArgs)e;
        if (e != null)
        {
            if (e.Item.Index == 0)
            {
                if (Session["update"].ToString() == ViewState["update"].ToString())
                {
                    //bind gridview
                }
               
            }
            if (e.Item.Index == 1)
            {
                if (Session["update"].ToString() == ViewState["update"].ToString())
                {
                       //bind gridview
                }
             
            }
            if (e.Item.Index == 2)
            {
                if (Session["update"].ToString() == ViewState["update"].ToString())
                {
                      //bind gridview
                }
                 
            }
            if (e.Item.Index == 3)
            {
                if (Session["update"].ToString() == ViewState["update"].ToString())
                {
                      //bind gridview
                }
            
            }
        }
    }



Thanks
Posted
Updated 9-Mar-12 2:02am
v3
Comments
Prasad_Kulkarni 9-Mar-12 7:36am    
please post your code..
[no name] 9-Mar-12 8:06am    
Code is not necessary. Nothing in the question speaks to anything specific wrong with the code.
vrushali katkade 9-Mar-12 8:03am    
plz see my edited question

You are using ASP.NET and it does use postbacks and the entire UpdatePanel will get refreshed. That's how this technology works; this isn't a desktop app.

You should review the documentation for the third party controls you are using to see if asynchronous methods are available. Most controls now have AJAX based operations.
 
Share this answer
 
XML
<div>
        <asp:label id="Label1" runat="server" text="Label" xmlns:asp="#unknown"></asp:label><br />
        <br />
        <asp:button id="Button1" runat="server" onclick="Button1_Click" text="Button" xmlns:asp="#unknown" /></div>



protected void Page_Load(object sender, EventArgs e)
   {
       if (!IsPostBack)
       {
           Session["CheckRefresh"] = Server.UrlDecode(System.DateTime.Now.ToString());
       }


   }
   protected void Button1_Click(object sender, EventArgs e)
   {
       if (Session["CheckRefresh"].ToString() == ViewState["CheckRefresh"].ToString())
       {
           Label1.Text = "Hello";
           Session["CheckRefresh"] = Server.UrlDecode(System.DateTime.Now.ToString());
           string str = "your code will save here or call save() method here";

       }
       else
       {
           Label1.Text = "Page Refreshed";
                   }

   }
   protected void Page_PreRender(object sender, EventArgs e)
   {
       ViewState["CheckRefresh"] = Session["CheckRefresh"];
   }
 
Share this answer
 
Comments
vrushali katkade 9-Mar-12 8:26am    
i already try this i have mention in my question
[no name] 9-Mar-12 10:48am    
This does nothing to address the OP's question about avoiding postback.

You are also storing the same data in two different places, session and viewstate which makes no sense.

Server.UrlDecode is total unnecessary and useless in this case. Do you understand what is it used for?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900