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

Validation Summary in rad window

6 Answers 311 Views
Window
This is a migrated thread and some comments may be shown as answers.
DK
Top achievements
Rank 2
DK asked on 13 Aug 2009, 05:01 AM
is there any way to show validation summary in radwindow or rad alert?

6 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 13 Aug 2009, 01:04 PM
Hello,

Try the following approach in order to show the RadAlert if the page is not validated.

ASPX:
<asp:TextBox ID="txt_name" runat="server" />  
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" ControlToValidate="txt_name" ErrorMessage="Name" Text="*" runat="server"/>  
  
<asp:ValidationSummary ID="ValidationSummary1" HeaderText="You must enter a value in the following fields:"  
    DisplayMode="BulletList" runat="server" EnableClientScript="false"  />  
<telerik:RadWindowManager ID="RadWindowManager1" runat="server"
</telerik:RadWindowManager> 
  
<asp:Button ID="b1" Text="Submit" runat="server" onmouseup="ShowAlert();" /> 

JavaScript:
 
<script type="text/javascript"
function ShowAlert() 
    Page_ClientValidate(); 
    if(!Page_IsValid) 
        radalert('Enter the required details..'); 
</script> 

-Shinu.
0
Stuart Hemming
Top achievements
Rank 2
answered on 13 Aug 2009, 03:51 PM
That's not showing the validation summary in a RadWindow though, is it? That's just saying "sort yourself out".
0
DK
Top achievements
Rank 2
answered on 14 Aug 2009, 03:23 AM
I got the solution to this problem
i am using the following code.
try it it is working fine for me.
but the problem is that if you want to display bulleted list of summary then you cant.
and besides this everything is working fine.


<
asp:TextBox ID="txt_name" runat="server" />  
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" ControlToValidate="txt_name" ErrorMessage="Name" Text="*" runat="server"/>  
  <div id="divSummary">
<asp:ValidationSummary ID="ValidationSummary1" HeaderText="You must enter a value in the following fields:"  
    DisplayMode="BulletList" runat="server" EnableClientScript="false"  validationgroup="reqFields" />  
</div>
<telerik:RadWindowManager ID="RadWindowManager1" runat="server"
</telerik:RadWindowManager> 
  
<asp:Button ID="b1" Text="Submit" runat="server" onmouseup="ShowAlert();" /> 


<script type="text/javascript"
function ShowAlert() 

var valGroup=    Page_ClientValidate("reqFields"); 
var summary = document.findElementbyId('divSummary').innerHTML;
    if(!valGroup) 
        radalert(summary'); 
</script> 
0
Bob
Top achievements
Rank 1
answered on 14 Aug 2009, 02:11 PM
Aside from the popup with an alert icon and the OK button, the radwindow provides nothing to the user. 
I had to change the javascript as below to get this to function:

 
<script type="text/javascript"> 
    function ShowAlert() { 
    var valGroup = Page_ClientValidate("reqFields"); 
    var summary = document.getElementById('divSummary'); 
    if(valGroup) 
        radalert(summary.innerHTML); 
    }
</script>

 

 

 

0
Fiko
Telerik team
answered on 14 Aug 2009, 04:00 PM
Hello Bob,

I have already answered your support ticket.

Best wishes,
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
Doug Beard
Top achievements
Rank 1
answered on 23 Sep 2009, 03:18 PM
Here's how I did it.

Place ValidationSummary on page as follows
<div id="divSummary"
 
        <asp:ValidationSummary ID="ValidationSummary1" HeaderText="There are errors on the page:" 
 
            DisplayMode="BulletList" runat="server" ValidationGroup="reqFields" /> 
 
    </div> 
 

Attach script function to postback control

<asp:Button ID="btnAdd" runat="server" Enabled="false" Text="Add" onmouseup="ShowAlert();" 
 
                        OnClick="btnAdd_Click" /> 

 

Now the script function
function ShowAlert() { 
 
        //Grab the Validation Group 
 
        var valGroup = Page_ClientValidate("reqFields"); 
 
        //grab the ValidationSummary Control 
 
        var objValidationSummary = document.getElementById("ValidationSummary1") 
 
        //slurp up the ValidationSummary Control's content and format as desired 
 
        var sValidationSummaryHTML = '<font color=\"red\">' + objValidationSummary.innerHTML + '</font>
 
        //Make sure to hide the ValidationSummary control since we'll display RadWindow instead 
 
        objValidationSummary.style.visibility = "hidden" 
 
        //If not IsValid on group, pop window and prevent postback 
 
        if (!valGroup) { 
 
            radalert(sValidationSummaryHTML, 450, 210); 
 
            return false; 
 
        } 
 
    }  

Tags
Window
Asked by
DK
Top achievements
Rank 2
Answers by
Shinu
Top achievements
Rank 2
Stuart Hemming
Top achievements
Rank 2
DK
Top achievements
Rank 2
Bob
Top achievements
Rank 1
Fiko
Telerik team
Doug Beard
Top achievements
Rank 1
Share this question
or