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

Radprompt - Get clicked button

3 Answers 64 Views
Window
This is a migrated thread and some comments may be shown as answers.
Laz
Top achievements
Rank 1
Laz asked on 16 Oct 2009, 12:39 PM

Hi to all,

it is possible to get the clicked button of a radprompt?

I try to check if the OK Button is clicked and the Textbox left blank to call another Alert with an error message.

My problem is that when i clicked the CANCEL Button i get the NULL Value and when i left blank the textbox and click the OK Button then i also geht the NULL Value.

    <script type="text/javascript">  
 
        function openPrompt(TitleText, Text, IText, IIndex) {  
            document.getElementById("<%= hdnIIndex.ClientID %>").value = IIndex;  
            radprompt(Text + '<br style="clear:both" /><strong>' + IText + '</strong>', promptCallBackFn, 330, 100, null, TitleText, null);  
        }  
 
        function promptCallBackFn(arg) {  
 
            document.getElementById("<%= hdnText.ClientID %>").value = arg;  
            if (arg != null && arg != '') {  
                document.getElementById("Refresh").click();  
            }  
            else {  
                radalert('You have clicked OK, but the text is blank', 330, 100, 'Error Msg'); return false;  
            }  
        }  
 
    </script> 

3 Answers, 1 is accepted

Sort by
0
Accepted
Georgi Tunev
Telerik team
answered on 19 Oct 2009, 07:13 AM
Hi Laz,

Please make sure that you are using a recent version of the control. RadWindow's radprompt dialog will return empty string if the textfield is left blank and the user hits the OK button.
function openPrompt()
{
 
    radprompt("Please provide value", callbackFn);
}
 
function callbackFn(arg)
{
    if(arg == "")
    {
        radalert("please provide valid value");
    }
}


Sincerely yours,
Georgi Tunev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Qing
Top achievements
Rank 1
answered on 21 Oct 2019, 07:50 AM
I would like to know of how to get this  ("<%= hdnIIndex.ClientID %>")  ? I got error for that.
0
Vessy
Telerik team
answered on 22 Oct 2019, 03:12 PM

Hi Qing,

Try wrapping the client-script logic containing server tags into RadCodeBlock and see if this will resolve the problem:

https://docs.telerik.com/devtools/aspnet-ajax/controls/ajaxmanager/radcodeblock-and-radscriptblock#radcodeblock

<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
    <script type="text/javascript">
        ...
    </script>
</telerik:RadCodeBlock>

 

Regards,
Vessy
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Window
Asked by
Laz
Top achievements
Rank 1
Answers by
Georgi Tunev
Telerik team
Qing
Top achievements
Rank 1
Vessy
Telerik team
Share this question
or