473,320 Members | 1,872 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Dropdownlist and requiredfieldvalidator postback problem

Hi,

I have a dropdownlist and a requiredfieldvalidator that checks if a
value has been selected for the dropdownlist by the user. I am
populating the ddl at runtime and adding two items ( "Please select"
and "All") the "Please select" option has a value of "".

The problem I am facing is that when I select the "Please select"
option the error message of the requiredfield validator gets displayed
for a second or so and then the page posts back. I wanted that the
error message should be displayed and the page shouldnt post back, am I
doing something wrong here?. I could check the value of the selected
item at the server side but thats just a waste of one round trip. The
autopostback property of the dropdownlist is set to true. Any help
would be appreciated . Thanks in advance.

Regards

Andy

Nov 19 '05 #1
1 2558
Hi anand
Try setting "please select" item values to "-1" and in requiredfield
validator give initial value as -1.
Let me know if this doesn't solve.
"an******@gmail.com" wrote:
Hi,

I have a dropdownlist and a requiredfieldvalidator that checks if a
value has been selected for the dropdownlist by the user. I am
populating the ddl at runtime and adding two items ( "Please select"
and "All") the "Please select" option has a value of "".

The problem I am facing is that when I select the "Please select"
option the error message of the requiredfield validator gets displayed
for a second or so and then the page posts back. I wanted that the
error message should be displayed and the page shouldnt post back, am I
doing something wrong here?. I could check the value of the selected
item at the server side but thats just a waste of one round trip. The
autopostback property of the dropdownlist is set to true. Any help
would be appreciated . Thanks in advance.

Regards

Andy

Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Frank | last post by:
Hello, I have some text boxes and 2 drop down lists (DDL) within a panel like so: Everything updates fine but the values from the DDLs are always the items selected by default. In other words,...
4
by: glenn | last post by:
Hi folks, I am getting an error "Object reference not set to an instance of an object". It seems I have everything in place but something is obviously in err. If you could take a quick peak...
2
by: Dabbler | last post by:
In my Registrant FormView I have a DropDownList which loads data from a secondary SqlDataSource "sdsOfficeParks". I need the user to select an office park but save the selected value in the...
0
by: ana_gil | last post by:
hello i have a problem with a dropdown list i am populating from an Access table. I´ve seen this problem in other discussions but i can´t seem to find the solution. please help. my .aspx has...
1
by: Kevin Blount | last post by:
I have a test script right now that I'm fighting with. The idea is to "simply" have an aspx page with 3 panels, to show 3 "different" forms and then a 4th panel to show the results of processing...
2
by: Kevin Blount | last post by:
I have a test script right now that I'm fighting with. The idea is to "simply" have an aspx page with 3 panels, to show 3 "different" forms and then a 4th panel to show the results of processing...
3
by: AG | last post by:
Below is code (slightly modified and converted to VB) that was provided to me in response to another post. I am using it to demonstrate another problem. In order for paging and other features to...
2
by: Steve Hershoff | last post by:
Hi everyone, I have a DataGrid with several TemplateColumns. One of these columns has an EditItemTemplate that contains an ASP.Net DropDownList. I'm catching this DropDownList's...
2
by: sree reddy | last post by:
..cs using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls;
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.