CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums
Results 1 to 2 of 2

Thread: How to Refresh the UserControl not the Whole Page In

  1. #1
    Join Date
    Dec 2007
    South Africa

    How to Refresh the UserControl not the Whole Page In

    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


        /*Enabling Partial */
        public bool EnablePartialRendering { get; set; }

    Am exposing the Properties of a usercontrol like like this

        public UpdatePanelUpdateMode UpdateMode
                return this.UpdatePanel1.UpdateMode;
                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

       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

    Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."

  2. #2
    Join Date
    Sep 2009

    Re: How to Refresh the UserControl not the Whole Page In

    As far as I know there is no way to reload a particular part of any page without using some type of independent HTTP request such as Ajax or a Web Service. If you post back it will always reload the entire page because that is what a postback is. You are sending the entire form back to the service for some processing before the entire form is to be rendered again.

    You could use Ajax to re-render a particular component of the page but for what you are describing I dont think that it is a good solution either. Is there any reason why you can't use client-side javascript to make the changes to your page while it's still on the client's machine?

    Using a javascript type approach you would just render the html for the full component. If EnablePartialRendering is set then it should just set the style attribute of the html elements you want not to be visible to style="display:none;". This will make sure that they are not visible in partial mode. Basically you would render some javascript that would look something like this:

    function PartialMode()
    //set style properties for elements to be hidden
    function FullMode()
    //set style properties for elements to be shown

Posting Permissions

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

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)