Radprompt - Get clicked button

4 posts, 1 answers
  1. Laz
    Laz avatar
    31 posts
    Member since:
    Apr 2009

    Posted 16 Oct 2009 Link to this post

    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> 
  2. Answer
    Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 19 Oct 2009 Link to this post

    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.
  3. Qing
    Qing avatar
    5 posts
    Member since:
    Aug 2019

    Posted 21 Oct 2019 in reply to Laz Link to this post

    I would like to know of how to get this  ("<%= hdnIIndex.ClientID %>")  ? I got error for that.
  4. Vessy
    Admin
    Vessy avatar
    2169 posts

    Posted 22 Oct 2019 Link to this post

    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.
Back to Top