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

edit opetion in radgrid

3 Answers 39 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dhamodharan
Top achievements
Rank 1
Dhamodharan asked on 26 Oct 2010, 07:45 AM
Hi,

I created radgrid edit option. when i open edit option it is fine. but when i clicked enter button in keyboard it is open create new option. i want solution.

Thanks
Dhamu.

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 26 Oct 2010, 08:15 AM
Hello Dhamu,

You can avoid this problem by adding "onkeydown" event to the TextBox and return false(which will not open insert form) if enter key is pressed. Sample code is given below.

ASPX:
<telerik:RadGrid ID="RadGrid2" GridLines="None" runat="server"
      OnItemDataBound="RadGrid2_ItemDataBound">
   <MasterTableView CommandItemDisplay="Top" EditMode="EditForms">
      <Columns>
        <telerik:GridBoundColumn DataField="EmployeeID" HeaderText="EmployeeID" UniqueName="EmployeeID">
        </telerik:GridBoundColumn>
        <telerik:GridEditCommandColumn>
        </telerik:GridEditCommandColumn>
      </Columns>
   </MasterTableView>
</telerik:RadGrid>

C#:
protected void RadGrid2_ItemDataBound(object sender, GridItemEventArgs e)
   {
       if ((e.Item is GridEditFormItem) && (e.Item.IsInEditMode))
       {
           GridEditFormItem gridEditFormItem = e.Item as GridEditFormItem;
           TextBox txtid = (TextBox)gridEditFormItem["EmployeeID"].Controls[0];
           txtid.Attributes.Add("onkeydown", "if(event.which || event.keyCode){if ((event.which == 13) || (event.keyCode == 13))  {return false};} ");
       }
   }

Thanks,
Princy.
0
Dhamodharan
Top achievements
Rank 1
answered on 26 Oct 2010, 11:31 AM
Hi Princy,

Thanks for your reply. it is working fine in textbox and radDatePicker also. but i clicked mouse in outside of the control the Enter key has been fired. is there any option control over the Form?

FYI: i am using master page content.

please give me a tips for this one.

Thanks a lot.

Dhamu
0
Dhamodharan
Top achievements
Rank 1
answered on 26 Oct 2010, 12:56 PM
Hi,

Please reply me.

Firefox working correctly. but IE8 fired Enter key. so i want solution for IE. enter key should not fire in hole page. can anyone help me?
Tags
Grid
Asked by
Dhamodharan
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Dhamodharan
Top achievements
Rank 1
Share this question
or