"If at first you don't succeed; call it version 1.0" :-Unknown

Pages

Wednesday, September 29, 2010

filling dropdown with numbers in a range

hi frienz,
2day i'm showing filling dropdown with numbers with in a range. by using a small for loop.

for that i created a function here. u need to pass 3 parameter to here dropdown name, from limit , to limit


        Public void dropdown(DropDownList cbo, int _from, int _To)
        {
            cbo.Items.Clear();
            for (int i = _from; i <= _To; i++)
            {
                cbo.Items.Add(new ListItem(i.ToString(), i.ToString()));
            }
                 }

Have a nice day... 'N happy Coding :)

No comments: