473,791 Members | 2,947 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

dynamic validation does not work

parshupooja
159 New Member
hey all,

I have DataTable binded to Gridview . This Datatable contains Data from Database. Before binding it to Gridview I am adding extra line with few controls dynamically in it such as text box below. When page loads I see extra Text box on the bottom of gridview but Validation is not working. Any Idea?

I am calling this Function on each page load.

Expand|Select|Wrap|Line Numbers
  1. Private Sub AddControls()
  2. Dim con As SqlConnection = New SqlConnection(ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString)
  3.         Dim cmd1 As SqlCommand = New SqlCommand("sp_get", con)
  4.         cmd1.CommandType = CommandType.StoredProcedure
  5.         Dim da1 As SqlDataAdapter = New SqlDataAdapter(cmd1)
  6.         Dim dt1 As DataTable = New DataTable
  7.         da1.Fill(dt1)
  8.         Dim dr1 As DataRow = dt1.NewRow
  9.         dt1.Rows.InsertAt(dr1, 0)
  10.  
  11.        Dim txtqty As New TextBox
  12.         txtqty.ID = "txtqtyextra"
  13.         txtqty.Width = 20
  14.  
  15.         Dim validation As New RequiredFieldValidator
  16.         validation.ID = "reqvaltxtqty"
  17.         validation.ControlToValidate = txtqty.ID
  18.         validation.ErrorMessage = "*"
  19.  
  20.         Dim custvalidation As New CompareValidator
  21.         custvalidation.ID = "custvalidationtxtqty"
  22.         custvalidation.ControlToValidate = txtqty.ID
  23.         custvalidation.ErrorMessage = "Value should be greater than 0"
  24.         custvalidation.Type = ValidationDataType.Integer
  25.         custvalidation.Operator = ValidationCompareOperator.GreaterThan
  26.         custvalidation.ValueToCompare = 0
  27. GridView1.Rows(GridView1.Rows.Count - 1).Cells(2).Controls.Add(txtqty)
  28.  End Sub
  29.  
Jun 30 '09 #1
0 1114

Sign in to post your reply or Sign up for a free account.

Similar topics

13
2898
by: mr_burns | last post by:
hi, is it possible to change the contents of a combo box when the contents of another are changed. for example, if i had a combo box called garments containing shirts, trousers and hats, when the user selects shirts another combo box called 'size' would contain sizes in relation to shirts (ie. chest/neck size). the same would occur for trousers and hats. when the user selects an option in the garment combo box, the options available...
1
1556
by: Toby Miller | last post by:
I have this form validation that I'm trying to build, but it's not working properly. A dynamic function to the onsubmit event for a form. the result of that function (true/false) should then be returned to pass or fail the submission of that form. What is happening is that in Firefox and IE returning false doesn't stop the form submission. In IE the dynamic function just doesn't work. If I attach a smaller dynamic function to the form...
1
2019
by: Mike George | last post by:
I am having a problem with dynamic validation controls. I have some code that uses an XSLT to transform an XMLDocument into HTML which creates ASP.NET validation controls dynamically (v 1.1). The controls are being successfully created, because validation works correctly in IE. However, validation does not work in Netscape. Additionally, if I check Page.IsValid in the submit button's onclick event, I get "true", even though the page...
1
1210
by: Luis Ferrao | last post by:
Hi, To understand the problem, a small description of the situation should be provided: I have a Field Control that is made of a one row table with three columns. The table width is 100%, the first column is 40% and the other two have a width of 30%. The middle cell has a TextField with 100% width followed by a requiredValidator (display set to dynamic).
1
2660
by: Nathan Sokalski | last post by:
When testing a form of mine which uses RequiredFieldValidators that have the Display property set to "Dynamic" the ErrorMessage property is automatically removed when an entry is completely typed and the user leaves the textbox. However, if the entry is selected from the list of previously typed entries, the error does not disappear until the page is validated using the Page.Validate() method. I find this very weird (not to mention it may...
3
1941
by: rgparkins | last post by:
Hi I am currently having problems with Validators in a user control. I am creating a wizard sign-up process which have the allocated step (hyperlinks" at the top of the page. A user can also click next/previous. Dependant on the current step in the sign-up process I am loading a new user control as I dont want to have 7-8 pages, just one page and load the control dynamically. All is sweet at the moment apart from the validation...
5
2543
by: matt | last post by:
hello, i am on an interesting project. in this project, i have to create dynamic data-entry forms for offline-users to fill out, save locally, and eventually postback to our app (when back online). data validation is required on the form. i had looked at using PDF-forms for this.. Adobe's "LifeCyle Forms" would work perfectly. with it one can pass in xml to their webservice & get back PDF-form binaries. however, Adobe's pricing is...
0
1548
by: Steve Funk | last post by:
All, I have searched all around and have not yet found the answer to this nor a solution. Hopfully it will be easy to overcome. Here is what I am trying to do: I'm trying to build a wizard form completely dynamic. I'm adding the labels, textboxes, drop downs, radio buttons, etc dynamically. I am able to add them via Page Init. Which seems to re-add every time a button or post back is initiated. Don't know if this is the problem.
0
9669
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10426
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9993
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9029
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7537
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5430
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4109
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3713
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2913
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.