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

radconfirm() and radprompt() codebehind HELP

8 Answers 384 Views
Window
This is a migrated thread and some comments may be shown as answers.
German
Top achievements
Rank 1
German asked on 30 Jul 2009, 02:16 PM
Is there any way to execute radconfirm and radprompt through codebehind in VB??
I need to re-use the variable that will be entered/clicked by the user.

8 Answers, 1 is accepted

Sort by
0
Stuart Hemming
Top achievements
Rank 2
answered on 30 Jul 2009, 03:25 PM
I can't help you with a code example, I don;t know VB from a hole in the head, but in C# I'd write
RadAjaxManaer1.ResponseScripts.Add("radconfirm('Are you sure?', confirmCallBackFn);"); 

Assuming that there was a RadAjaxManager on the page. If there's not, something like ...
ClientScript.RegisterStartupScript(this.GetType(), "confirm""<script type='text/javascript'>radconfirm('Are you sure?', confirmCallBackFn);</script>"); 

--
Stuart
0
German
Top achievements
Rank 1
answered on 30 Jul 2009, 06:01 PM

Thanks for your reply. I've gotten the radconfirm() and radprompt() to display the way i wanted them to.
My next question is the following: From the aspx.vb page, Is it possible to grab the variable the user enters into a
radprompt or radconfirm. For instance, grabbing that variable and inserting it into a database or do anything else within the vb page.
This is an example code for my radprompt:

 

Dim

 

radconfirm As String = "<script language='javascript'>function f(){radconfirm
('This is a <b>Confirm Window</b>!', confirmCallBackFn, 300, 150); return false;
Sys.Application.remove_load(f);};</script>"

 

 

 

 

Page.ClientScript.RegisterStartupScript(Me.[GetType](), "radconfirm", radconfirm)

 

 

 

 

 

 

 

Dim confirmCallBackFn As String = "<script language='javascript'>function confirmCallBackFn
(arg){radalert('Prompt returned the following result: ' + arg + ' ', 250, 150, 'ANSWER TITLE');
Sys.Application.remove_load(f);}; Sys.Application.add_load(f);</script>"

 

 

 

 

 

Page.ClientScript.RegisterStartupScript(Me.[GetType](), "confirmCallBackFn", confirmCallBackFn)

 

 

 

 

 

 

 

0
Stuart Hemming
Top achievements
Rank 2
answered on 30 Jul 2009, 07:29 PM
German,

One way would be to put the value in to a hidden input field in your callback function and then force a postback (or call back if you're using Ajax). You can then get the value in your postback handler on the server.

Hope this helps.

Don't forget to mark is post as "Answered" if it sorts out your problem.

--
Stuart
0
German
Top achievements
Rank 1
answered on 31 Jul 2009, 04:26 PM

Thank you, your reply was very helpful in what i was trying to accomplish.
I'm currently using a GridView to display data and I have created a linkbutton
to delete any row of information. I have gotten a regular confirm prompt to display
asking the user if they would like to delete. The options "Yes" and "No" work well with a regular
confirm window. I want to apply a RadConfirm to the gridview as opposed to the regular
confirm window. I have gotten the radConfirm to display, however, the "Yes" and "No" buttons
do not work accordingly. This is the code I have to display my radconfirm:

 

<

 

asp:TemplateField ShowHeader="False">

 

 

 

 

<

 

 

ItemTemplate>

 

 

 

    <asp:LinkButton ID="LinkButton1" runat="server"
     CausesValidation="False" CommandName="Delete"

 

 

 

 

     OnClientClick="radconfirm('Delete ??',300, 400, null, 'TITLE'); return false;">Delete</asp:LinkButton><br style="clear:both" /><br 
     style
="clear:both" />

 

 

 

 

</ItemTemplate>

 

 

 

 

 

</

 

asp:TemplateField>

 

 

 

 

 

 

 

 

0
Stuart Hemming
Top achievements
Rank 2
answered on 01 Aug 2009, 10:06 AM
German,

I can see why this /won't/ work, and that's 'cos you don't have a callback function in your radconfirm call; without that there's no way to get at the result of the confirm dialog.

I'm not convinced about the following, but if you try using the same basic idea you used before to save the radconfirm result, you can handle the postback and do your delete then.

As I say, I'm not 100% sure that this is the best way to do this, but if you don't get it to work you can either wait for a grown-up to wander passed and answer it or ask over in the Grid forum where there are more clever chaps than you can wave a stick at.

Don't forget to mark this post as "Answered" if it sorts out your problem.

--
Stuart
0
Fiko
Telerik team
answered on 03 Aug 2009, 11:13 AM
Hi German ,

I believe that this KB will be of help.


Greetings,
Fiko
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
German
Top achievements
Rank 1
answered on 03 Aug 2009, 04:11 PM
Thank you for your reply. It helped out alot. Is there any way to modify the Skin style? given
that the radprompt is composed of a LinkButton and javascript. I'm also using a GridView and not
a RADGridView. And is it possible to execute a radprompt much the same way as in the
earlier example? and use the input for whatever? 
0
Fiko
Telerik team
answered on 05 Aug 2009, 10:32 AM
Hi German ,

In reference to your questions :

  • You could easily change the look and feel of the predefined dialogs by declaring the templates in the RadWindowManager as described in this help page.
  • Yes, you could use the same approach to open the radprompt dialog. Please note however that this is a custom solution and you need to implement it yourself
I hope this helps.

Kind regards,
Fiko
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Window
Asked by
German
Top achievements
Rank 1
Answers by
Stuart Hemming
Top achievements
Rank 2
German
Top achievements
Rank 1
Fiko
Telerik team
Share this question
or