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

Confirm before insert

4 Answers 117 Views
Grid
This is a migrated thread and some comments may be shown as answers.
saravanan k
Top achievements
Rank 1
saravanan k asked on 12 May 2010, 11:25 AM
Hi all,

             I am new to telerik controls. I am using a radgrid with usercontrol insert from inside a modal popup. I am getting variable names as inputs.
ex)
If user enters the string in this format //variablename//. Then is should consider variablename as a variable. All the string parsing is done in the server side and i am getting list of all variables. Now i should show the list of identified variables in a confirmation popup and proceed with the insert if the user clicks ok and stay in the popup mode if he clicks cancel. I tried some attempts using radconfirm, but i am not able to do it completely.

Kindly guide me right from opening a radconfirm with customized text, avoiding insert on click of cancel, and proceed with insert if ok is clicked. Or if exists any better option to do this requirement, please suggest.

Regards,
Saravanan K

4 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 12 May 2010, 01:32 PM
Hello Saravanan,

You could attach the 'OnClientClick' event to button placed in user control and in the handler call the radconfirm. In the confirmCallBackFn() of radconfirm, you can invoke button_click explicitly depending on whether the user clicks "OK" or "Cancel".

ASPX:
<asp:Button ID="Button1" runat="server" Text="Insert" CommandName="PerformInsert" 
    OnClientClick="return showConfirm(this);" /> 


JavaScript:
<script type="text/javascript"
    var buttonObj; 
    var confirmValue = false
    function showConfirm(btn) { 
        if (!confirmValue) { 
            buttonObj = btn; 
            radconfirm('Are you sure?', confirmCallBackFn); 
            return false
        } 
    } 
    function confirmCallBackFn(arg) { 
        if (arg) { 
            confirmValue = true
            buttonObj.click(); 
        } 
    } 
</script> 
 


Thanks,
Princy.
0
saravanan k
Top achievements
Rank 1
answered on 12 May 2010, 02:33 PM
Thanks for the reply, it worked. But can i showthe text in much formatted manner?

ex)

The following variables are identified. Please Confirm,
     1) variable name 1
     2) variable name 2

And the button text as Proceed and Cancel.
And also the title of the window as Confirm Variables before insert.

Please help.

Regards,
Saravanan K


0
saravanan k
Top achievements
Rank 1
answered on 13 May 2010, 01:12 PM
I tried str1 +"\n" + str2 which gave a line break in javascript confirm box.. but in radconfirm it is recogonized as a single space. Please guide me regarding this.

Regards,
Saravanan K
0
Princy
Top achievements
Rank 2
answered on 13 May 2010, 02:34 PM
Hello Saravanan,

Try  ' <br /> ' for line break in RadConfirm and it is possible to add the title as a parameter.

JavaScript:
 
  . . . 
radconfirm('The following variables are identified. Please Confirm, <br /> 1) variable name 1 <br /> 2) variable name 2', confirmCallBackFn, 350, 200, """Confirm Variables before insert"); 
  . . . 


Regards,
Princy.
Tags
Grid
Asked by
saravanan k
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
saravanan k
Top achievements
Rank 1
Share this question
or