Click here to Skip to main content
15,887,214 members
Home / Discussions / C#
   

C#

 
GeneralRe: Set Color of Pen and Brush Pin
ASPnoob22-May-13 21:44
ASPnoob22-May-13 21:44 
GeneralRe: Set Color of Pen and Pen Pin
DaveyM6922-May-13 21:54
professionalDaveyM6922-May-13 21:54 
QuestionNew Button in SaveFileDialog Pin
umd22-May-13 9:38
umd22-May-13 9:38 
AnswerRe: New Button in SaveFileDialog Pin
Mycroft Holmes22-May-13 12:50
professionalMycroft Holmes22-May-13 12:50 
AnswerRe: New Button in SaveFileDialog Pin
Abhinav S22-May-13 18:27
Abhinav S22-May-13 18:27 
AnswerRe: New Button in SaveFileDialog Pin
Richard MacCutchan22-May-13 21:06
mveRichard MacCutchan22-May-13 21:06 
AnswerRe: New Button in SaveFileDialog Pin
umd23-May-13 8:52
umd23-May-13 8:52 
QuestionDeveloping pager for winform application c# Pin
Tridip Bhattacharjee22-May-13 4:45
professionalTridip Bhattacharjee22-May-13 4:45 
i search google first to get any ready made sample for numeric pager for win form but unfortunately i found none. many exist for web application. so i have decided to develop my own. i have take one user control and i want to add some label on the user control at run time for simulating numeric pager link.

like << < 1 2 3 4 5 > >>

here is my code so far

C#
public partial class PagerBar : UserControl
    {
        public PagerBar()
        {
            InitializeComponent();
        }

        int totalrecords = 0;
        public int TotalRecords 
        { 
            get { return totalrecords; }
            set { totalrecords = value; }
        }

        int recordsperpage = 0;
        public int RecordsPerPage
        {
            get { return recordsperpage; }
            set { recordsperpage = value; }
        }

        int curpage = 0;
        public int CurrentPage
        {
            get { return curpage; }
            set { curpage = value; }
        }

        int maxpagerlink = 0;
        public int MaxPagerLink
        {
            get { return maxpagerlink; }
            set { maxpagerlink = value; }
        }

        public bool HasPreviousPage
        {
            get
            {
                return (CurrentPage > 1);
            }
        }

        /// <summary>
        /// Gets the boolean value of next page
        /// </summary>
        public bool HasNextPage
        {
            get
            {
                return (CurrentPage + 1 <= RecordsPerPage);
            }
        }

        int pagecount = 0;
        public int PageCount
        {
            get 
            { 
                pagecount = TotalRecords > 0 ? (int)Math.Ceiling(TotalRecords / (double)RecordsPerPage) : 0;
                return pagecount; 
            }

        }

        public void BuildPager(int CurrentPage)
        {
            if (CurrentPage >= MaxPagerLink)
            {

            }
            else
            {

            }
        }
    }


my first prev,next & prev button will be fixed. i will not generate these button at run time. i want to generate only numeric link like 1 2 3 4 5 etc at run time on user control.

one thing i need to fix that number of pager bar is will be fixed in my case and that is 5. i want to show always 5 pager link like 1 2 3 4 5 or 6 7 8 9 10 etc.

suppose total records is 36 and i want to show 10 records per page so 4 pager link i need to generate at run time. the right logic is not coming to my mind to generate pager link in such a way if number of records is 110 then everything should be handle properly. if total records is 110 and records per page is 10 then total pager bar should be 11 but i want to show only 5 at a time. first time 1 2 3 4 5 when user click on 5th pager bar and next time click on next button then pager link will be 6 7 8 9 10. this way i want to show pager link but right logic is not coming to mind to generate the way i want to display pager link. it will be great help if some one help me to handle generation of 5 pager link always.
tbhattacharjee

Questionunable to launch C sharp Windows application using Windows 7 Pin
Member 961158422-May-13 4:08
Member 961158422-May-13 4:08 
AnswerRe: unable to launch C sharp Windows application using Windows 7 Pin
Pete O'Hanlon22-May-13 6:00
mvePete O'Hanlon22-May-13 6:00 
QuestionMake datagridview selected row invisible Pin
geralson22-May-13 1:41
geralson22-May-13 1:41 
AnswerRe: Make datagridview selected row invisible Pin
Richard MacCutchan22-May-13 2:42
mveRichard MacCutchan22-May-13 2:42 
GeneralRe: Make datagridview selected row invisible Pin
geralson22-May-13 3:32
geralson22-May-13 3:32 
QuestionExcel without excel Pin
caradri22-May-13 0:34
caradri22-May-13 0:34 
AnswerRe: Excel without excel Pin
Richard Deeming22-May-13 1:46
mveRichard Deeming22-May-13 1:46 
AnswerRe: Excel without excel Pin
PIEBALDconsult22-May-13 5:03
mvePIEBALDconsult22-May-13 5:03 
GeneralRe: Excel without excel Pin
caradri22-May-13 5:19
caradri22-May-13 5:19 
Question2D Array Managed and Unmanaged code Data Marshling Pin
Subhash Madhukar21-May-13 22:34
Subhash Madhukar21-May-13 22:34 
AnswerRe: 2D Array Managed and Unmanaged code Data Marshling Pin
David Knechtges22-May-13 3:28
David Knechtges22-May-13 3:28 
QuestionQuestion about constructors of a class Pin
Arun kumar Gautam21-May-13 18:22
Arun kumar Gautam21-May-13 18:22 
AnswerRe: Question about constructors of a class Pin
PIEBALDconsult21-May-13 18:50
mvePIEBALDconsult21-May-13 18:50 
GeneralRe: Question about constructors of a class Pin
Arun kumar Gautam21-May-13 19:06
Arun kumar Gautam21-May-13 19:06 
AnswerRe: Question about constructors of a class PinPopular
Pete O'Hanlon21-May-13 20:21
mvePete O'Hanlon21-May-13 20:21 
GeneralRe: Question about constructors of a class Pin
Arun kumar Gautam21-May-13 20:43
Arun kumar Gautam21-May-13 20:43 
AnswerRe: Question about constructors of a class Pin
DaveyM6921-May-13 22:12
professionalDaveyM6921-May-13 22:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.