Validating a row in grid view and show message

554 Views Asked by At

I am using telerik controls only. I am validating a row and if the validation fails on certain condition.I need to open the radwindow and show the message to the user saying there is some error.

private void radGridViewHolidays_RowValidating(object sender, GridViewRowValidatingEventArgs e)
    {
   if (condition )
        {
           e.valid=false;
           Radwindow.Alert("error message");
         }
    }

When I execute the above code the radwindow flickers and I cant close the window nor can I change the value in the grid.

My issue is: When the validation fails the row gets the focus and at the same time I need to show the error message to the user.

When I use a messagebox.show(), it works fine. I need to use only the telerik control(Radwindow)to achieve this.

1

There are 1 best solutions below

10
On

an object, that represents the content and an event handler that should handle the Closed event of the RadWindow.

private void radGridViewHolidays_RowValidating(object sender, GridViewRowValidatingEventArgs e)
    {
   if (condition )
        {
           e.valid=false;
           Radwindow.Alert("error message", this.OnClosed);
         }
    }

try like this

private void OnClosed( object sender, WindowClosedEventArgs e )
{
    RadWindowManager.Current.CloseAllWindows();
}

C#

RadWindowManager1.RadAlert("An <br /><b>html</b> string.<br />", 200, 100);

Note:The appearance of the alert dialog is controlled by two things: the Skin property of the RadWindowManager, and the values you pass in as arguments to RadAlert. The arguments can include the HTML string you pass in as a message, the width, the height, and the Title string.

For more info