This is a migrated thread and some comments may be shown as answers.

Paging problem if PageSize value is null

1 Answer 46 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Felice
Top achievements
Rank 1
Felice asked on 20 Oct 2014, 07:19 PM
I am using this line of code to allow the user to choose the page size:

private void radTextBox1_TextChanged(object sender, EventArgs e)
        {
             radGridView1.MasterTemplate.PageSize = Int32.Parse(radTextBox1.Text);
        }

It works fine until the textbook is empty. In such case the amount of rows get stacked to 1 and there is no more control. I mean, paging size does not work anymore. Is this an expected behavior? 
I solved it like this:
if (radTextBox1.Text != "")
            {
                radGridView1.MasterTemplate.PageSize = Int32.Parse(radTextBox1.Text);
            }


Thanks

1 Answer, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 23 Oct 2014, 10:38 AM
Hello Felice,

Thank you for writing.

You should make sure that the page size will always be equal to or larger that 1. In this case I would recommend you check if the parse operation is successful before setting the PageSize property or you can use RadSpinEditor instead of a textbox.

Please let me know if there is something else I can help you with. 
 
Regards,
Dimitar
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
GridView
Asked by
Felice
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Share this question
or