.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Field validators does not work when field is manipulated with ajax

Posted By:      Posted Date: September 03, 2010    Points: 0   Category :ASP.Net
Hi.I have defined a field validator that works fine on normal behavior on a page:<asp:RequiredFieldValidator runat="server" ErrorMessage="errroooorr"  ControlToValidate="TextBoxHouseNumber" Display="Dynamic"></asp:RequiredFieldValidator>Now if I dont insert any text in the TextBoxHouseNumber field, and push submit, the FieldValidator fires as it should. But if I now click a button that automatically fills the TextBoxHouseNumber with text from a Jquery/Ajax function, the field validator still shows. It´s like "Hey, the user hasnt made any changes to the textbox, so I wont bother check it".How can I overcome this problem?Thanks alot! :)

View Complete Post

More Related Resource Links

Server-side validation on an Entity Framework required field (property) does not work!

Has anyone had issues getting server-side validation on an Entity Framework required field (property) to work? The data type is a string (nvarchar). Server-side validation for required fields of other data types WORK fine. Only string fields have issues. I get the following error on UpdateModel(obj); of my POST method within the controller. Exception Details: System.Data.ConstraintException: This property cannot be set to a  null value.Source Error: Line 4500:                OnTextChanging(value);Line 4501:                ReportPropertyChanging("Text");Line 4502:                _Text = StructuralObject.SetValidValue(value, false);Line 4503:                ReportPropertyChanged("Text");Line 4504:                OnTextChanged(); I've even tried data annotations like this but it seems to get ignored.     [MetadataType(typeof(ObjMD))]     public partial class Obj     {    

AJAX ComboBox - required field validator

Hi All, I want to put validation on a combobox to ensure user selects/enters a value. I've tried using a the standard required field validator which doesn't work. So I would like to do the validation using javascript/jquery. Not sure how to approach. When I look at how the combo box is rendered, it appears as a unordered html list. There is also a hidden field but this always seems to be set to 0. So is it possible to do this validation client side. I've read so many posts about this but I havn't got an answer yet. Am I on the wrong path here? Any ideas? Thanks

How can I get search to work for a Custom Document Library with a few third-party field types?

Hi, Using WSS 3.0 with SQL Server 2008 for Workgroups I have created a Custom Document Library (2,462 files - copied from folder into Explorer view and then renamed using Batch Update in web services i.e. "BaseName" field) - basically it uses three fields that are of "Filtered Lookup" (a field type from a third party). The document library is included in the search (i.e. Advanced Settings), but it displays none of the files - bascially not included in search at all with all testing I have done. I created a new Document Library called "Test" and uploaded a document and it is included in the search. Is there any way I can debug this. Is there a log file? Is there something in the Search Database that might help? Your help would be really appreciated as this is my last issue - and its soooo important to the deliverable. Thanks. John.

Custom field type - set value doesn't work when field is hidden

Hi, I have a simple custom field type which gets a value from the Property Bag and sets that value to a label. This works fine as long as the field is set to Optional (the field is a site column and is part of a site content type), but if I set it to Hidden, the value doesn't get set. public override void UpdateFieldValueInItem()         {             this.EnsureChildControls();               if (this.ControlMode == SPControlMode.New)             {                 this.Value = GetChosenConsole();             }         }   Does anyone know why this is and what I need to do in order for it to work even though it's hidden? Thanks!

ASP.Net Dynamic Data - DropDownList Field Template with AJAX Cascading DropDown Extension

Hi all,   Have spent hours trying to create a Dynamic Data Field Template holding a DropDownList which is extended by the AJAX Cascading DropDown extension. Final form holds multiple cascading dropdown boxes. User selects Country (Land) then Postcodes, Counties (Provincie) are populated. Once postcode is selected then towns (Plaats) are populated.  The problem I am now facing is that the viewstate for the dropdown lists is not being saved/restored after an insert action or custom validation error. So basically the dropdown lists are being reset to their default values. Some code (if missing parts, just ask and I will post them) - Don't mind the code structures etc... needs some refactoring :) Attribute I created:using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Data { [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false)] sealed public class CascadingDropDownParametersAttribute : Attribute { //public string TargetControlID; // The ID of the DropDownList to populate. public string Category; // The name of the category this DropDownList represents. public string PromptText; // Optional text to display before the user has selected a value from the DropDownList. public string

how to do a ajax integrated validation in required field sharepoint newform.aspx

hi all, i have newform.aspx in sharpeoint list where in i have 2 cols which are reqd field. how would i make the server side validation without refreshing the page.. can i put it ajax update panel ?  how would i achieve this requirement.jayaraja

field validators



I want to ask how I can be sure that one of two textboxes contains data when click the button ,,,,

am using RequiredFieldValidator as bellow

<asp:TextBox ID=TextBox1 runat=server Width=150px></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="Required!" ControlToValidate="TextBox1">
<asp:TextBox ID=TextBox2 runat=server Width=150px></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="Required!" ControlToValidate="TextBox2">

and for button

<asp:Button ID=Button1 runat=server Text="SendMail" CausesValidation=true Width=70px OnClick="Button1_Click" />




"Does not contain" condition on a choice field in a SPD Workflow does not apply/work


I am trying to check a multiple choice field on containing a specific value but it doesn't really work. I am not sure if that is because I have a

problem with the logic or if that is a SPD problem.

I created a Content Type "Test CT" (based on the "item" content type) and added two Site Columns of the type "choice", named "Test Column 1" and

"Test Column 2" to that content type. Both choice fields are configured to contain multiple values and can contain the identical values "Product

ABC" and "Product XYZ". Additionally I added Site Column of the type "Single Line of text", named "Result" to the content type. Then I added the

content type to the custom list "Test List".

Now I built the Reusable Sharepoint Designer Workflow "Test WF" that is based on this content type and that works like this:


Set "Result" to String "Start"

If "Test Column 1" contains String "Product ABC"
Set "Result" to String "Test Column 1 contains ABC"

Else If "Test Column 1" does not contain String "Product ABC"
Set "Result" to String "Test Column 1 does not contain ABC"


Then I

Site content type's column with wrong field type that was created once will not work if re-created


I've created the column 'MyDescription' with type 'Multiline Enchanced Text' in my custom content type derived from 'Page'. But later I understood that 'Publishing HTML' is better for me. I've removed the 'MyDescription' column and recreated 'MyDescription' with type 'Publishing HTML'.

Page layout for my custom content type uses this code to display field

<PublishingWebControls:RichHtmlField FieldName="MyDescription" runat="server"/>

But page falls without any error information. I've deleted and recreated page: it fell always.

When I created column 'MyDescription1' with 'Publishing HTML' type in my custom content type and changed code to this


How to avoid receiving DUE date field in Collect Feed Back Work Flow?

I have create a share point 2010 workflow, in my form there is a optional field called Due Date .If i dint select any date in that it give date like 01/01/0001 

Instead of that i need to hide or set i have to set some text to it. How to do this???

How to use required field validator along with ajax tool kit editor control?



How to use required field validator along with ajax toolkit editor control?

required field dosen't work in collect



I have collect action in sharepoint designer 2007 and define choice field & multiple line of text and uncheck “Allow blank values” setting to force user to enter data; but in collect.aspx page although these fields seem to be required and have red star beside them but actually it dosen’t force user to select and user can ignore these fields.

Why “Allow blank values” setting does’nt work?!!! What is wrong?

I’m very appreciated if anyone can help me.


calculation, field and map traverse adjustment, and coordinate transformation

Free Pocket PC land surveying software -- COGO calculation, field and map traverse adjustment, and coordinate transformation -- for students and professionals.

Dropdown Event (Template Field)



I have grid view control that includes a dropdown control in a template field.

I wish to execute some code when the value is changed in the dropdown list.  Can't figure out how to capture this event though?

Any suggestions?

How to take value of bound field of grid in a variable or in a textbox.


How to take value of bound field of grid in a variable or in a textbox.

 I m using this code in .aspx page for grid.

<asp:GridView ID="Grd_Mprocess" runat="server" AutoGenerateColumns="False"

                      Width="100%" AllowPaging="True"


                      AllowSorting="True" PageSize="5"  >

                 <RowStyle CssClass="odd" />


<asp:BoundField HeaderText="DOC_TYPE_PK" DataField="DOC_TYPE_PK"  Visible="true" >


  <asp:TemplateField HeaderText="DOC TYPE ID" Visible="true">  &nbs

Looking for guidance: wanting to work with AJAX architecture



I'm starting a small website that will be backed by a database, and will allow a small number of users to authenticate and select an entry in the database, and then view (and optionally update) a corresponding entry (think master-detail).

I have some flexibility in how I'll do this, but I'd really like to incorperate some newer AJAX style coding, eliminating some page postbacks. I think this is a great opportunity to learn the concepts well.

I'll probably go with an ASP.NET 4.0 site. From what I've seen there are MANY ways to go about this:

-WCF Data Services to expose the data, and consume in ASP.NET

-Page methods to expose the data, separate method to update the data

-I'd rather avoid the UpdatePanel because I'm really looking for a full hands-on approach, with learning client side scripting being an objective as well.

Beyond that, it seems that one can use jQuery to build clientside templates, but also one can use the ASP.NET AJAX template engine (in ASP.NET 4.0 I believe).

A concern I have: users should only be able to work with the data exposed via these endpoints if they are logged into the website. Hopefully I can somehow reuse the ASP.NET forms authentication cookie for this purpose. 

Well, I hope I've posted enough to a

I need help about nvarchar field



how can specified nvarchar data type without N''?

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend