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

[Solved] CustomValidator in RadAjaxPanel

1 Answer 138 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
umit celik
Top achievements
Rank 1
umit celik asked on 27 Oct 2009, 03:29 PM

I am using customvalidor in a radajaxpanel but clientside script not make any validation. my aspx code is:
Thsi is my user control

 

 

 

<table> 
 
<tr> 
 
<td> 
 
SampleRequired  
 
</td> 
 
<td> 
 
<asp:CheckBox id="chSampleRequired" runat="server">  
 
</asp:CheckBox> 
 
 
</td> 
 
</tr> 
 
<tr> 
 
<td> 
 
Sample Dead Line  
 
</td> 
 
<td> 
 
<telerik:RadDateTimePicker ID="deSampleDeadLine" runat="server">  
 
</telerik:RadDateTimePicker> 
 
 
<asp:CustomValidator ID="CustomValidator1" runat="server"   
 
ClientValidationFunction="SampleInfoValidation" ControlToValidate="deSampleDeadLine" 
 
 
ErrorMessage="CustomValidator"></asp:CustomValidator> 
 
 
 
 
 
</td> 
 
</tr> 
 
<tr> 
 
<td> 
 
SampleAttentionTo  
 
</td> 
 
<td> 
 
<telerik:RadTextBox ID="tbSampleAttentionTo" runat="server" Width="170px">  
 
</telerik:RadTextBox> 
 
 
</td> 
 
</tr> 
 
<tr> 
 
<td> 
 
SampleAddress  
 
</td> 
 
<td> 
 
<telerik:RadTextBox ID="tbSampleAddress" runat="server" Width="170px">  
 
</telerik:RadTextBox> 
 
</td> 
 
</tr> 
 
</table> 
 


only chSampleRequired checkbox checked validation can occur, for this reason  i want ro use a custom validtator.


My aspx page
<head runat="server">  
 
<title></title>  
 
<script language="javascript" type="text/javascript">  
 
function SampleInfoValidation(source, agruments) {  
 
 
arguments.IsValid = true;  
 
 
}  
 
</script> 
 
</head> 
 
<body> 
 
<form id="form1" runat="server">  
 
<telerik:RadScriptManager ID="RadScriptManager1" runat="server">  
 
</telerik:RadScriptManager> 
 
<div> 
 
<telerik:RadAjaxLoadingPanel runat="server" ID="LoadingPanel1" IsSticky="true" > 
 
 
</telerik:RadAjaxLoadingPanel>   
 
<telerik:RadScriptBlock ID="RadScriptBlock2" runat="server">  
 
<script type="text/javascript">  
 
// on upload button click temporarily disables ajax to perform  
 
// upload actions  
 
function conditionalPostback(sender, args) {  
 
args.set_enableAjax(false);  
 
 
}  
 
</script> 
 
</telerik:RadScriptBlock> 
 
<telerik:RadAjaxPanel ID="RadAjaxPanel1" 
 
runat="server" Width="100%" Height="200px" LoadingPanelID="LoadingPanel1">  
 
<div style="float:left;width:200px">  
 
<telerik:RadTabStrip runat="server" ID="tabNewTender" MultiPageID="mpNewTender" Orientation="VerticalLeft"/>  
 
</div> 
 
<div style="float:left;width:300px">  
 
<telerik:RadMultiPage runat="server" ID ="mpNewTender"   
 
onpageviewcreated="mpNewTender_PageViewCreated" SelectedIndex="0" > 
 
 
 
</telerik:RadMultiPage> 
 
</div> 
 
<div style="clear:both; margin-left:200px">  
 
<tw:pager runat="server" ID ="twpager" /> 
 
</div> 
 
</telerik:RadAjaxPanel> 
 
</div> 
 
</form> 
 
</body> 
 
</html> 
 
 

I load user control dynamically.

1 Answer, 1 is accepted

Sort by
0
O'Man
Top achievements
Rank 1
answered on 30 Oct 2009, 10:46 AM
Hi Umit,

Please try to change the "agruments" parameter to "arguments" in your SampleInfoValidation() function declaration. In addition to verify that the client validation is fired just set the arguments.IsValid = false; inside the function:

function SampleInfoValidation(source, arguments) 
        { 
            arguments.IsValid = false
        }   

I hope this helps.
Oman
Tags
General Discussions
Asked by
umit celik
Top achievements
Rank 1
Answers by
O'Man
Top achievements
Rank 1
Share this question
or