Setting page size on grid using a custom control edit form

3 posts, 1 answers
  1. Dave Miller
    Dave Miller avatar
    64 posts
    Member since:
    Oct 2004

    Posted 10 Sep 2009 Link to this post

    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. Answer
    Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 11 Sep 2009 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Dave Miller
    Dave Miller avatar
    64 posts
    Member since:
    Oct 2004

    Posted 12 Sep 2009 Link to this post

    Shinu,

    That works!

    Thanks
    Dave
Back to Top