This is a migrated thread and some comments may be shown as answers.

Keeping a grid in edit mode

2 Answers 39 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Brendan Vogt
Top achievements
Rank 1
Brendan Vogt asked on 11 Sep 2008, 07:46 AM
Hi,

I have a grid, and I have been struggling with required field validators now like almost forever.  So I took out the required field validators and replaced them with Label controls.

If the grid is in edit mode and the Update button is clicked I do a check to see if the textbox is empty, if so, then I set the Label control's text to "Required".  I did a debug on this and it seems to go through 100%, but I can't seem to keep the grid in edit mode.  How do I do this?

Thanks
Brendan

2 Answers, 1 is accepted

Sort by
0
Missing User
answered on 11 Sep 2008, 08:58 AM
Hello Brendan,


You can first check the type of the command (e.CommandName) and then cancel it as needed. This may be something like in the code snippet below:

    protected void RadGrid1_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e) 
    { 
        if (e.CommandName == "Update"
        { 
            e.Canceled = true
        } 
    } 


All the best,
Plamen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Princy
Top achievements
Rank 2
answered on 11 Sep 2008, 09:09 AM
Hello Brendan,

You can get this done on the UpdateCommand. Check if the TextBox is empty and then populate the label and also set the e.canceled property to true.
 
Princy.


Tags
Grid
Asked by
Brendan Vogt
Top achievements
Rank 1
Answers by
Missing User
Princy
Top achievements
Rank 2
Share this question
or