Results 1 to 7 of 7

Thread: How to Refresh the UserControl not the Whole Page In ASP.net

  1. #1

    Thread Starter
    Fanatic Member vuyiswamb's Avatar
    Join Date
    Jan 2007
    Location
    South Africa
    Posts
    830

    How to Refresh the UserControl not the Whole Page In ASP.net

    Good Day All

    I have a UserControl in my page. i want to Reload it and refresh it everytime i click a Button, i only want it to be refreshed not the whole page. at the moment i force the postback with the
    Code:
    response.Redirect("mycurrentpage.aspx");
    Its working but the Page Flickers a Lot.

    Thanks

  2. #2
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: How to Refresh the UserControl not the Whole Page In ASP.net

    Hey,

    Have a look here:

    http://www.asp.net/Ajax/Documentatio...datePanel.aspx

    Specifically at this page:

    http://www.asp.net/AJAX/Documentatio...rControls.aspx

    And you should find your answer.

    Gary

  3. #3

    Thread Starter
    Fanatic Member vuyiswamb's Avatar
    Join Date
    Jan 2007
    Location
    South Africa
    Posts
    830

    Re: How to Refresh the UserControl not the Whole Page In ASP.net

    Good Morning

    I have the Following User Control in the Pic "UserControl_Design_Mode.JPG" and i have the Following code to enable Partial Rendering

    UserControl_Design_Mode.JPg


    Code:
        /*Enabling Partial */
    
        [DefaultValueAttribute(true)]
    
        [CategoryAttribute("Behavior")]
        
        public bool EnablePartialRendering { get; set; }

    Am exposing the Properties of a usercontrol like like this


    Code:
        public UpdatePanelUpdateMode UpdateMode
        {
    
            get
            {
                return this.UpdatePanel1.UpdateMode;
            }
            set
            {
                this.UpdatePanel1.UpdateMode = value;
            }
    
    
        }

    And there are of them


    and i went to the Hosting page we have a pic




    for Example, in the Button Remove i have Finally something like this


    Code:
       Response.Redirect("SubjectStaff.aspx", false); //Refresh the Page again
    I was Forcing a Postback and the Whole Page flickers, i want to Refresh only the UserControl.

    i tried the Following instead of the above statement



    Here am trying to call the name of the usercontrol first and then the Properties it exposes, but i only get the load and load1 event , it seems every is hiden now since i have taken the Control inside the Update Paanel in the User Control.


    Can you Help me in that Regard

    Thanks
    Attached Images Attached Images    
    Last edited by vuyiswamb; May 20th, 2009 at 01:40 AM.

  4. #4
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: How to Refresh the UserControl not the Whole Page In ASP.net

    Hey,

    To be honest, I haven't really yet played with the UpdatePanel, I simply know about it's existence, and the tutorial I linked to sounded like it would have exactly what you needed. My best guess would be that the UpdatePanel is a Control Container, and as such you will need to use the FindControl method to first locate the control that you want, cast it as the correct type, and then you can access the properties that you have on it.

    Hope that helps!!

    Gary

  5. #5

    Thread Starter
    Fanatic Member vuyiswamb's Avatar
    Join Date
    Jan 2007
    Location
    South Africa
    Posts
    830

    Re: How to Refresh the UserControl not the Whole Page In ASP.net

    That is true, it seems after adding the Update panel i could not even use the name of usercontrol to do that as you seen in the pic.

  6. #6
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: How to Refresh the UserControl not the Whole Page In ASP.net

    Hey,

    I would try the FindControl method and see how you get on. I think this should resolve your issue.

    I one concern that I might have is that I don't though enough about the best practices surrounding UpdatePanel and I don't know whether you should be using this method. i.e. should the information you are wanting to add not already exist in the update panel as well.

    Gary

  7. #7

    Thread Starter
    Fanatic Member vuyiswamb's Avatar
    Join Date
    Jan 2007
    Location
    South Africa
    Posts
    830

    Re: How to Refresh the UserControl not the Whole Page In ASP.net

    Thanks, for the meant time i will keep on finding some results in google
    Last edited by vuyiswamb; May 20th, 2009 at 02:10 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width