473,395 Members | 1,535 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,395 software developers and data experts.

validating a webpage before first postback

Hi,

I am creating a webform in ASP.NET using C#.

I have a drop down list control and 5 textbox controls.

Each textbox control has a required field validator assigned to it.

I have a save button on the form.

When I first load the form and immediately hit the save button the field
validators work automatically, but the save button click event which I haved
put a break point on in the code behind page never fires.

It will fire only after I have done my first drop down list change event
which causes a post back.

I want to be able to have my save button click event execute on click before
a first post back.

How do I circumnavigate this behavior?

thanks

Chris
Nov 19 '05 #1
4 1512
On Fri, 30 Sep 2005 12:06:02 -0700, Chris wrote:
Hi,

I am creating a webform in ASP.NET using C#.

I have a drop down list control and 5 textbox controls.

Each textbox control has a required field validator assigned to it.

I have a save button on the form.

When I first load the form and immediately hit the save button the field
validators work automatically, but the save button click event which I haved
put a break point on in the code behind page never fires.

It will fire only after I have done my first drop down list change event
which causes a post back.

I want to be able to have my save button click event execute on click before
a first post back.

How do I circumnavigate this behavior?
I ran into the problem when I forgot to set the OnClick attribute for
the button. This happens when you are translating from a VB.NET page to a
C# page.

Perhaps this help!

Nov 19 '05 #2
So what happens when you click the 'save' button before touching the
drop-down list? does it postback the page and just fires the page_load()
event? or not even that?

"Chris" <Ch***@discussions.microsoft.com> wrote in message
news:6A**********************************@microsof t.com...
Hi,

I am creating a webform in ASP.NET using C#.

I have a drop down list control and 5 textbox controls.

Each textbox control has a required field validator assigned to it.

I have a save button on the form.

When I first load the form and immediately hit the save button the field
validators work automatically, but the save button click event which I
haved
put a break point on in the code behind page never fires.

It will fire only after I have done my first drop down list change event
which causes a post back.

I want to be able to have my save button click event execute on click
before
a first post back.

How do I circumnavigate this behavior?

thanks

Chris

Nov 19 '05 #3
yes, the field validators do their job but the save click event does not occur.

i believe if i knew where to put the break pointer I could find out exactly
when the
field validator's fire.

either way: neither the page load event for the page is entered or the save
click event, its almost like it is client side script firing., maybe it is?
"Raul Macias" wrote:
So what happens when you click the 'save' button before touching the
drop-down list? does it postback the page and just fires the page_load()
event? or not even that?

"Chris" <Ch***@discussions.microsoft.com> wrote in message
news:6A**********************************@microsof t.com...
Hi,

I am creating a webform in ASP.NET using C#.

I have a drop down list control and 5 textbox controls.

Each textbox control has a required field validator assigned to it.

I have a save button on the form.

When I first load the form and immediately hit the save button the field
validators work automatically, but the save button click event which I
haved
put a break point on in the code behind page never fires.

It will fire only after I have done my first drop down list change event
which causes a post back.

I want to be able to have my save button click event execute on click
before
a first post back.

How do I circumnavigate this behavior?

thanks

Chris


Nov 19 '05 #4
I would check if the events for those two objects (your page and the save
button) are hooked up correctly.
In design view, go to the properties window. Select your page object from
the drop-down list and switch to the events section. Then check if the load
event has something assigned to it. If there is nothing there, that's the
problem. Do the same for the save button.

"Chris" <Ch***@discussions.microsoft.com> wrote in message
news:0F**********************************@microsof t.com...
yes, the field validators do their job but the save click event does not
occur.

i believe if i knew where to put the break pointer I could find out
exactly
when the
field validator's fire.

either way: neither the page load event for the page is entered or the
save
click event, its almost like it is client side script firing., maybe it
is?
"Raul Macias" wrote:
So what happens when you click the 'save' button before touching the
drop-down list? does it postback the page and just fires the page_load()
event? or not even that?

"Chris" <Ch***@discussions.microsoft.com> wrote in message
news:6A**********************************@microsof t.com...
> Hi,
>
> I am creating a webform in ASP.NET using C#.
>
> I have a drop down list control and 5 textbox controls.
>
> Each textbox control has a required field validator assigned to it.
>
> I have a save button on the form.
>
> When I first load the form and immediately hit the save button the
> field
> validators work automatically, but the save button click event which I
> haved
> put a break point on in the code behind page never fires.
>
> It will fire only after I have done my first drop down list change
> event
> which causes a post back.
>
> I want to be able to have my save button click event execute on click
> before
> a first post back.
>
> How do I circumnavigate this behavior?
>
> thanks
>
> Chris


Nov 19 '05 #5

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

Similar topics

3
by: Stephen | last post by:
Im trying to do a function to validation two textbox controls. I want the user to enter in text to either txtSurname or txtCompanyName but not both. Is my logic wrong and if so can someone help me...
4
by: bremdevnet | last post by:
I have a ASPX page that loads a custom control. This first custom control is made up of 2 textboxes and a Submit button. The user enters data into the form, presses the Submit button and the ASPX...
1
by: panche | last post by:
I'm developing a fairly simple user control that has two textboxes for date/time entry (a from date/time and a to date/time). One of my requirements is that there should be no button that sets...
11
by: tshad | last post by:
I have 4 dropdown boxes (fromDay, fromMonth, ToDay and ToMonth) I want to be able to test to make sure that the dates are valid and the the From dates are < the To dates. When I add the...
0
by: Gary Shell | last post by:
I am experiencing some strange behavior between a UserControl's validating event and a treeview control. Initially, I thought it was related to an issue in the Knowledgebase article 810852...
2
by: PapaRandy | last post by:
Hello, I am trying to validate the following .py webpage as HTML (through W3C). I put: ----------------------------------------------------------------------------- print "Content-type:...
3
by: Barry | last post by:
Hi have a webpage with some controls at the top and a Table control at the bottom. programmatically add the table header and Data rows using TableRow() and Cells using Cell(), the Table is...
2
by: ravitunk | last post by:
can anyone tell me how to validate a fileupload control to accept the files upto 4MB and anything more than 4MB to give a message(or a popup alert) without a postback to server......i dont want the...
14
by: =?Utf-8?B?UGF1bA==?= | last post by:
Hi I tried a google search but could not find anything. I am trying to cause one webpage to reload when a second web page is closed. The second webpage loads data into a session variable and when...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.