RadGrid - Validation with DataBinding

3 posts, 0 answers
  1. Vijaianand
    Vijaianand avatar
    82 posts
    Member since:
    Jul 2012

    Posted 07 Sep 2011 Link to this post

    Hi

    I am looking to see whether RadGRid has inbuilt databinding validation. For example, if you have NOT NULL field and trying to insert the column with null, it should throw an error without any code. I see this exists in devexpress. It helps to bind the data and allow the validations to be binded against data fields instead of field validators. I hope this may be possible.

    Let me know.

    Vijai
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 07 Sep 2011 Link to this post

    Hello VijaiAnand,

    One suggestion is to use ItemDataBound event and check for the populated value.
    C#:
    protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
    {
        if (e.Item is GridDataItem)
        {
            GridDataItem dataItem = e.Item as GridDataItem;
            if (dataItem["ColumnUniqueName].Text == "")
                //your code goes here
        }
    }

    Thanks,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Vijaianand
    Vijaianand avatar
    82 posts
    Member since:
    Jul 2012

    Posted 08 Sep 2011 Link to this post

    That's one of the ways of doing it. I was looking for something already inbuilt in the RadGrid which will take the databinding while inserting/updating the row.  It exists in DevExpress GridView but I was hoping for something similar. 

    Vijai
Back to Top