How to validate web Controls in atlas

G

Guest

Hi,

I am new to atlas, I would like to add validations to webControls.
Here is the following code is working fine without masterpage.



Withe master Page i am getting error.

--code

<%@ Page MasterPageFile="~/MasterPage.master" Language="C#"
AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
<atlas:ScriptManager ID="ScriptManager1" runat="server" />
<div>
<asp:TextBox ID="TextBox1" runat="server" />
<span id="validator1" style="color: red">Please Enter
FirstName</span>
<asp:TextBox ID="TextBox2" runat="server" />
<span id="validator2" style="color: red">Please Enter
LastName</span>
<asp:Button ID="BtnSubmit" runat="server" Text="Submit" />
</div>
<div id="formGroup"></div>

<script type="text/xml-script">
<page xmlns:script="http://schemas.microsoft.com/xml-script/2005">
<references>
<add src="ScriptLibrary/AtlasUI.js" />
<add src="ScriptLibrary/AtlasControls.js" />
</references>
<components>
<textBox targetElement="TextBox1">
<validators>
<requiredFieldValidator errorMessage="You must enter some
text." />
</validators>
</textBox>
<validationErrorLabel targetElement="validator1"
associatedControl="TextBox1" />

<textBox targetElement="TextBox2">
<validators>
<requiredFieldValidator errorMessage="You must enter
some text." />
</validators>
</textBox>
<validationErrorLabel targetElement="validator2"
associatedControl="TextBox2" />

<validationGroup id="formGroup" targetElement="formGroup">
<associatedControls>
<reference component="TextBox1" />
<reference component="TextBox2" />
</associatedControls>
</validationGroup>

<button targetElement="BtnSubmit" >
<bindings>
<binding dataContext="formGroup" dataPath="isValid"
property="enabled" />
</bindings>
</button>
</components>
</page>
</script>
</asp:Content>

--end code

I know the reason why I am gettting error.



Page controls are rendered at server end, and has different client IDs for
controls.

Control Id's are not matching with xmlScript targetElement Names and
component names.

How do i generate the xml-script from the server end.



Is there any way to work with server controls.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top