Validating Gridview Row

1 posts, 0 answers
  1. Prabhu
    Prabhu avatar
    25 posts
    Member since:
    Feb 2008

    Posted 27 Feb 2012 Link to this post

    Hi,
    I have a gridview and the columns in that grid are dynamically generated at runtime. Now I need to validate those columns in button click.
    Since all the columns are created dynamically, i created a button dynamically with the help of the following code.

    GridViewDataColumn Env1 = new GridViewDataColumn();
                Env1.Header = "Stop Timer";
                Env1.UniqueName = "btnStopTimer";
                StringBuilder CellETemp = new StringBuilder();
                CellETemp.Append("<DataTemplate ");

                CellETemp.Append("xmlns='http://schemas.microsoft.com/winfx/");
                CellETemp.Append("2006/xaml/presentation' ");

                CellETemp.Append("xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml' ");
                CellETemp.Append("xmlns:basics='clr-namespace:System.Windows.Controls;");

                CellETemp.Append("assembly=System.Windows.Controls' >");
                CellETemp.Append("<StackPanel Orientation='Horizontal' HorizontalAlignment='Left' >");
                CellETemp.Append(" <Button x:Name='BtnStop1' Height='25' HorizontalAlignment='Left' ");
                CellETemp.Append(" Margin='5' ");
                CellETemp.Append(" Content='Stop Timer' />");
                CellETemp.Append("</StackPanel>");
                CellETemp.Append("</DataTemplate>");
                Env1.CellTemplate = (DataTemplate)XamlReader.Load(CellETemp.ToString());
                grdProcessLog.Columns.Add(Env1);
    Now  I need to do an insert the data when the button is clicked and before that I need to validate the columns.
    I do not need the same to be done in roweditended event, I want the operation t be done in the button click event. it seems that we cannot have the event handler. is there a work around for that?
Back to Top