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

Setting page size on grid using a custom control edit form

2 Answers 47 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dave Miller
Top achievements
Rank 2
Dave Miller asked on 10 Sep 2009, 06:18 PM
I am getting a "The specified value cannot be set on pagesize" error when trying to change the page size with the "NextPrevNumericAndAdvanced" pager while using a custom control edit form.

The line that seems to be causing the error is:
UserControl userControl = (UserControl)e.Item.FindControl(GridEditFormItem.EditFormUserControlID);

In the beginning of the function:

protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e)  
        {  
            GridEditableItem editedItem = e.Item as GridEditableItem;  
            UserControl userControl = (UserControl)e.Item.FindControl(GridEditFormItem.EditFormUserControlID);  
 
            switch (e.CommandName)  
            {  
                case "PerformInsert": 

If I Comment this line out ( incuding references to userControl )  setting the page size works.

I am using the newest version 2009.2.906.20

The grid is in a UserControl that I am dynamically adding to the page but I do not have any problems with any other functionality.

Any Ideas on what might be causing this?

Thanks in advance,
Dave

2 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 11 Sep 2009, 11:36 AM
Hi Dave,

I would suggest you to move the code for accessing the Edit/Insert form inside the Switch- Case as shown below.

CS:
 
 protected void RadGrid2_ItemCommand(object source, GridCommandEventArgs e) 
    { 
       
       switch (e.CommandName) 
       { 
           case "PerformInsert"
               GridEditableItem editedItem = e.Item as GridEditableItem; 
               UserControl userControl = (UserControl)e.Item.FindControl(GridEditFormItem.EditFormUserControlID); 


Shinu
0
Dave Miller
Top achievements
Rank 2
answered on 12 Sep 2009, 02:03 PM
Shinu,

That works!

Thanks
Dave
Tags
Grid
Asked by
Dave Miller
Top achievements
Rank 2
Answers by
Shinu
Top achievements
Rank 2
Dave Miller
Top achievements
Rank 2
Share this question
or