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

[Solved] KeyPress for Perform Insert,Edit ,InitInsert,Cancel

1 Answer 58 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Salman
Top achievements
Rank 1
Salman asked on 06 Apr 2013, 07:52 AM
Hi all member
I have a Radgrid .I want with press a special key perform a action like Cancel.So I create a KeyPress method for grid but when in method raise cancel Insert or cancel edit method it cause fire  validator in template column. and show a error javascript.
please help to me for resolve this problem.(Note: I want not use KeyboarNavigationSupport in radgrid)
thanks.

1 Answer, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 07 Apr 2013, 04:26 PM
Hello,

Please try with below code snippet.

<ValidationSettings CommandsToValidate="PefrormInsert, Update" EnableValidation="true">
       </ValidationSettings>

OR

protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
        {
 
            if (e.Item.IsInEditMode)
            {
                if (e.Item is GridDataInsertItem)
                {
                    GridEditableItem editItem = (GridEditableItem)e.Item;
                    LinkButton CancelButton = (LinkButton)editItem.FindControl("CancelButton");
                    CancelButton.CausesValidation = false;
                }
                else
                {
                    GridEditableItem editItem = (GridEditableItem)e.Item;
                    LinkButton CancelUpdateButton = (LinkButton)editItem.FindControl("CancelButton");
                    CancelUpdateButton.CausesValidation = false;
                }
            }
}


Thanks,
Jayesh Goyani
Tags
Grid
Asked by
Salman
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Share this question
or