Validation on ExpandCollapseColumn

3 posts, 0 answers
  1. Thomas
    Thomas avatar
    143 posts
    Member since:
    Feb 2007

    Posted 20 Oct 2008 Link to this post

    Is there a way to show a validation message on attempting to expand or collapse?

    What I have is a grid with an editable NumericTextBox in the ItemTemplate of one of the columns. It is the only value that is editable on the given row of the grid but it is editable immediately on viewing the grid. I have a top level Save button such that when clicked it saves all of the values entered in any of the textboxes on the grid.

    However, these same rows can have child records. The catch is that if there is no value greater than zero entered in the parent row's NumericTextBox, the user shouldn't be able to expand the child rows.
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 20 Oct 2008 Link to this post

    Hi,

    Try the following code snippet to achieve the required scenario:
    CS:
      protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e) 
            { 
                if (e.CommandName == RadGrid.ExpandCollapseCommandName) 
                { 
                    GridDataItem item = (GridDataItem)e.Item; 
                    if (item.GetDataKeyValue("CompanyName").ToString() == "Around the Horn") 
                    { 
                        e.Canceled=true
                    } 
                } 
            } 


    Thanks,
    Shinu
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Thomas
    Thomas avatar
    143 posts
    Member since:
    Feb 2007

    Posted 21 Oct 2008 Link to this post

    Thank you! I discovered this very same technique yesterday after I wrote my post.
Back to Top