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

AllowOnSubmit restricting customized fields on radgird popup for click on Enter button

1 Answer 19 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Sandeep Shah
Top achievements
Rank 1
Sandeep Shah asked on 27 Sep 2012, 02:53 PM
Hi ,

Please help me to get out from the below mentioned situtaion.

Requirement :
we have radgrid and on click of add new record a pop up is opened where we have few customized fields.
We have a radtext box which is attched with a radbutton , once the user enter any details in the text box and click on the button the same needs to be populated in Checkbox list provided just below . and finally when user is done filling up all the details and then clicks on enter button the record needs to be saved to database.

What we following we did .
first we made AllowOnSubmit = true ( We have to use this as when we are editiing the record its inline and when we inserting its pop up , so when user updates in inline mode and hits enter button this property will helpt to update the same.)

Problem :
1) Due to the above property on pop up the  when ever user tries to enter value in the textbox and hits enter, the radbutton assosiated with text box is not being click ( where as its was taking if we do not use the above property), the following event is fired and its forced to insert the record. "PerformInsert" its the command name for the save button of pop up.
Even though we have validation applied on the pop up it still goes to cs page.

We tried to handle the same using Javascripts but it fails as it forced to over write that property.

we did tried to over write the below thigns

args._eventTarget

args._postbackControlClientID

args.EventTarget

to acheive the target event of ADD button rather its taking Save button even and performs the action.

2) Also we are getting e.CommandName but we are not able to use e.CommandSource.

Please suggest us on the above .

Thanks in advance.

1 Answer, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 02 Oct 2012, 11:22 AM
Hi Sandeep,

Could you please try to use the following approach to interrupt submitting from the RadTextBox:
   mark-up:
<telerik:RadTextBox ... ClientEvents-OnKeyPress="keyPressed" />
  JavaScript:
function keyPressed(sender, args) {
    if (args.get_keyCode() == 13) {
        args.set_cancel(true);
 
        var radButton = null;
        var tableView = sender.get_parent();
        if (tableView.get_isItemInserted()) {
            radButton = $telerik.findControl(tableView.get_insertItem(), "RadButton1");
        }
        else {
            radButton = $telerik.findControl(tableView.get_editItems()[0].get_editFormItem(), "RadButton1");
        }
 
        radButton.click();
    }
}

I hope this will prove helpful. Please give it a try and let me know about the result.

Greetings,
Eyup
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
Sandeep Shah
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Share this question
or