Click here to Skip to main content
15,920,438 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i tried to apply the same tutorial for jquery.validationEngine to validate a textbox ( for required ) which is in ( Insert and Edit Templete ) of a FormView, but it didnt work , if i use an inline form it work fine the code i use is :
JavaScript
<script type="text/javascript">
         $(document).ready(function () {
             $("#FormView1").validationEngine();
         });
 
</script>


ASP.NET
<asp:FormView ID="FormView1" runat="server" DefaultMode="Insert" ClientIDMode="Static"  >
     <insertitemtemplate>
        &lt;asp:TextBox ID="TextBox1" runat="server" class="validate[required]"&gt;
    </insertitemtemplate>
        <edititemtemplate>
            &lt;asp:TextBox ID="TextBox1" runat="server" class="validate[required]"&gt;
        </edititemtemplate>


Thanks
Posted
Updated 27-Sep-11 19:34pm
v3
Comments
DaveAuld 28-Sep-11 1:33am    
Edited: a) Its not urgent as far a the codeproject users are concerned. Thats just plain rude. b) Whats with all the whitespace in your code snippets, I removed all that.

you can do it from cs code also....
just find that particular textbox on submit button(imaginary) and use validate function
 
Share this answer
 
Comments
C0deMani@ 28-Sep-11 8:56am    
can you give me more details on this way ?
You can also add the asp validater control in your form view.
 
Share this answer
 
Comments
C0deMani@ 28-Sep-11 8:56am    
i tried the ASP:customValidator and its got another broblem , the error text shown in the Edit templete biut not in the insert Templete
hi mani
yes of course i'll give

try this

suppose your textbox name is TextBox1 now find it on button click event or in validate function as:

C#
TextBox txt = ((TextBox)FormView1.FindControl("TextBox1"));


now the object "txt" will work as TextBox.
do anything with it....
it has all the properties of textbox
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900