Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET DevExpress
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 9-Mar-12 1:34am
Edited 9-Mar-12 2:02am
v3
Comments
pashad at 9-Mar-12 7:36am
   
please post your code..
Mark Nischalke at 9-Mar-12 8:06am
   
Code is not necessary. Nothing in the question speaks to anything specific wrong with the code.
vrushali katkade at 9-Mar-12 8:03am
   
plz see my edited question
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

<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"];
    }
  Permalink  
Comments
vrushali katkade at 9-Mar-12 8:26am
   
i already try this i have mention in my question
Mark Nischalke at 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?
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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.
  Permalink  

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



Advertise | Privacy | Mobile
Web02 | 2.8.140709.1 | Last Updated 9 Mar 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid