I have a C# custom webpart in sharepoint 2013, display listview from a document library. This library will be updated if we submit a form. I want to update this Webpart each x time. Here is my code:

tRow.Cells.Add(tCell); Table.Rows.Add(tRow);

1 Answer 1


your code doesnt show anything todo with the timer itself, just adding some data to cell...

1) bind the list through your code to a table or what ever container your using, like splistview:


2) now create the timer on the page within code behind to refresh the page x ammount of times:




as for coded solution to just timerjob though .cs only:

add this to define the int val we would want to check against:

     private int timecounter = 10;

add following to page load event to run every 60 seconds:

        Timer t = new Timer();
        t.Tick += new EventHandler<EventArgs>(t_Tick);
        t.Interval = 60000

then create the event when above is called:

    private void t_Tick(object sender, EventArgs e)
          if (timecounter == 0)
                //reload page, somthing on the lines of

instead of reload the page, you can rebind the listview by calling .bind() again, you would need to change the code slightly but it would work well instead of reloading whole page.


you can use JQuery or JavaScript

Refreshing custom developed web part



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.