Hi Qin Dian Tang,
Thanks for the answer but those links don't respond to my question. The first two only show how to create a DataPager from design mode, and I already have that as you can see from the code I've pasted, and the last one shows how to create a use control that will be used as a PagerTemplate of a DataPager control.
What I'm trying to do is something close to that last link, but I want to create a Server Control wich will render dynamically and completely a DataPager control.
I know how to create a DataPager from code, I just don't know how to create the custom PagerTemplate and associate it to the PagerControl.
How can I create an ITemplate with other controls or HTML like this:
<div class="counter"> <%# Container.StartRowIndex + 1 %> to <%# ((Container.StartRowIndex + Container.PageSize) > Container.TotalRowCount ? Container.TotalRowCount : (Container.StartRowIndex + Container.PageSize)) %> of <%# Container.TotalRowCount %> records </div>
And then associate this ITemplate to the DataPager control variable.
What I want is to recreate the code on the first post, that was done in design mode, dynamically in a C# class, for a Server Control.