Hi,
I need to validate a control inside the radgrid (If empty show message). Here is what i have comeup with. But this doesn't seem to be working.
Thanks in advance
I need to validate a control inside the radgrid (If empty show message). Here is what i have comeup with. But this doesn't seem to be working.
Thanks in advance
<%@ Page Title="" Language="VB" MasterPageFile="~/master/default.master" AutoEventWireup="false" CodeFile="SubProductOrSrvcAdminstration.aspx.vb" Inherits="EncoreBMF_SubProductOrSrvcAdminstration" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register assembly="System.Web.Entity, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" namespace="System.Web.UI.WebControls" tagprefix="asp" %>
<
asp:Content
ID
=
"Content1"
ContentPlaceHolderID
=
"HeaderContent"
Runat
=
"Server"
>
</
asp:Content
>
<
asp:Content
ID
=
"Content2"
ContentPlaceHolderID
=
"MainContent"
Runat
=
"Server"
>
<
style
type
=
"text/css"
>
div.ex
{
width:480px;
padding:10px;
border:2px solid gray;
margin:0px;
}
</
style
>
<
asp:ValidationSummary
ID
=
"ValidationSummary1"
runat
=
"server"
Enabled
=
"true"
ForeColor
=
"Red"
HeaderText
=
"Errors:"
ShowSummary
=
"true"
DisplayMode
=
"List"
/>
<
telerik:RadFormDecorator
ID
=
"FormDecorator1"
runat
=
"server"
DecoratedControls
=
"all"
>
</
telerik:RadFormDecorator
>
<
telerik:RadAjaxManager
ID
=
"RadAjaxManager1"
runat
=
"server"
>
<
AjaxSettings
>
<
telerik:AjaxSetting
AjaxControlID
=
"ValidationSummary1"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"ValidationSummary1"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
<
telerik:AjaxSetting
AjaxControlID
=
"rgSubProdOrSvc"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"rgSubProdOrSvc"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
</
AjaxSettings
>
</
telerik:RadAjaxManager
>
<
telerik:RadCodeBlock
ID
=
"RadCodeBlock1"
runat
=
"server"
>
<
script
type
=
"text/javascript"
>
function clientSubsvcValidation(source, arguments) {
var currentCell = source.parentNode;
var currentRow = currentCell.parentNode
//get a reference to the calling validator control
var CustomValidator1 = source.id;
//get the value of the GridBoundColumn 'salesperson'
var SubSvcID;
var SubSvcName;
SubSvcID = $telerik.findElement(currentRow, CustomValidator1.replace('CustomValidator1', 'EncoreProductSubServiceId')).value
SubSvcID = $telerik.findElement(currentRow, CustomValidator1.replace('CustomValidator1', 'SubServiceName')).value
}
</
script
>
</
telerik:RadCodeBlock
>
<
div
class
=
"ex"
> Sub-Products / Services Administration
<
hr
runat
=
"server"
id
=
"Hr1"
style
=
"border-color: #659EC7"
/>
<
br
/>
<
telerik:RadGrid
ID
=
"rgSubProdOrSvc"
runat
=
"server"
GridLines
=
"None"
DataSourceID
=
"edsProductSubService"
AutoGenerateColumns
=
"False"
>
<
MasterTableView
DataSourceID
=
"edsProductSubService"
DataKeyNames
=
"EncoreProductSubServiceId"
EditMode
=
"InPlace"
AllowAutomaticInserts
=
"false"
AllowAutomaticUpdates
=
"false"
AllowAutomaticDeletes
=
"false"
CommandItemDisplay
=
"TopAndBottom"
>
<
NoRecordsTemplate
><
div
>Click on the plus(+)sign above to add a Sub-Product to the grid.</
div
></
NoRecordsTemplate
>
<
EditItemTemplate
>
<
asp:CheckBox
ID
=
"chkIsActive"
runat
=
"server"
Checked = '<%# Eval("IsActiveFlag") %>' />
<
asp:TextBox
ID
=
"txtsubSvcName"
runat
=
"server"
Text='<%# Eval("SubServiceName") %>'></
asp:TextBox
>
<
asp:CustomValidator
ID
=
"CustomValidator1"
ControlToValidate
=
"txtsubSvcName"
ClientValidationFunction
=
"clientSubsvcValidation"
Display
=
"Dynamic"
ErrorMessage
=
"Not an even number!"
Text
=
"Please enter a valid Sub-product name"
Font-Name
=
"verdana"
Font-Size
=
"10pt"
runat
=
"server"
/>
<%-- <
asp:RequiredFieldValidator
ID
=
"RequiredFieldValidator1"
ControlToValidate
=
"txtsubSvcName"
ErrorMessage
=
"Please enter a valid Sub-product name"
Display
=
"Dynamic"
runat
=
"server"
>*
</
asp:RequiredFieldValidator
> OnServerValidate="ServerUnitPriceValidation" --%>
<
asp:TextBox
ID
=
"txtSvcShortName"
runat
=
"server"
Text='<%# Eval("SubServiceShortName") %>'></
asp:TextBox
>
</
EditItemTemplate
>
<%-- <
ItemTemplate
>
<
asp:CheckBox
ID
=
"chkIsActiveIT"
runat
=
"server"
Checked='<%# Eval("IsActiveFlag") %>'></
asp:CheckBox
>
<
asp:Label
ID
=
"lblsubSvcName"
runat
=
"server"
Text='<%# Eval("SubServiceName") %>'></
asp:Label
>
<
asp:Label
ID
=
"lblsubSvcShortName"
runat
=
"server"
Text='<%# Eval("SubServiceShortName") %>'></
asp:Label
>
</
ItemTemplate
>--%>
<
CommandItemSettings
ExportToPdfText
=
"Export to Pdf"
/>
<
Columns
>
<
telerik:GridEditCommandColumn
>
</
telerik:GridEditCommandColumn
>
<
telerik:GridCheckBoxColumn
DataField
=
"IsActiveFlag"
HeaderText
=
"Inactive"
UniqueName
=
"Inactive"
>
</
telerik:GridCheckBoxColumn
>
<
telerik:GridBoundColumn
DataField
=
"SubServiceName"
HeaderText
=
"Sub-prod/svc Name"
UniqueName
=
"SubServiceName"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"SubServiceShortName"
HeaderText
=
"Short Name"
UniqueName
=
"SubServiceShortName"
>
</
telerik:GridBoundColumn
>
</
Columns
>
<
EditFormSettings
>
<
EditColumn
UniqueName
=
"EditCommandColumn1"
>
</
EditColumn
>
</
EditFormSettings
>
</
MasterTableView
>
</
telerik:RadGrid
>
<
asp:EntityDataSource
ID
=
"edsProductSubService"
runat
=
"server"
ConnectionString
=
"name=Entities"
DefaultContainerName
=
"Entities"
EntitySetName
=
"EncoreProductSubService"
Select
=
"it.[EncoreProductSubServiceId], it.[IsActiveFlag], it.[SubServiceName], it.[SubServiceShortName] "
>
</
asp:EntityDataSource
>
<
br
/>
<%-- </
div
>--%>
<
asp:LinkButton
ID
=
"lnkAddBundl"
runat
=
"server"
>Add Sub-prod / svc</
asp:LinkButton
>
<
br
/>
<
br
/>
<
br
/>
<
br
/>
<
br
/>
<
br
/>
</
div
>