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

aspx function

All,

I have a ASP.NET/C# webform that contains a ASPRegularExpressionValidator
and a ASPRequiredFieldValidator, the form contains many fields to be filled
in. I have a send button at the bottom of the page that calls a function
within the webform that checks to see if the page is valid. If it is not a
label next the send button appears informing the user but if the page is
valid I would like to call a function in my code behind class is this
possible and how ?

Thanks
Msuk
Nov 18 '05 #1
3 1175
The RegularExpressionValidator and the RequiredFieldValidator are both
client-side validation controls. Therefore, the form will not submit until
you page is valid. Any code you put in your code behind class will fire
once the page is valid and the form is submitted.

--
Travis Murray
MCSD, MCT
Artiem Consulting, Inc.
http://www.artiem.com
Learn ASP.Net In Jamaica in 2005!

Visit http://www.artiem.com/jamaica.aspx for more details.
"msuk" <ms**@discussions.microsoft.com> wrote in message
news:C2**********************************@microsof t.com...
All,

I have a ASP.NET/C# webform that contains a ASPRegularExpressionValidator
and a ASPRequiredFieldValidator, the form contains many fields to be filled in. I have a send button at the bottom of the page that calls a function
within the webform that checks to see if the page is valid. If it is not a
label next the send button appears informing the user but if the page is
valid I would like to call a function in my code behind class is this
possible and how ?

Thanks
Msuk

Nov 18 '05 #2
You got it all wrong.

In the click event of the button, do something like this:

MyButton_Click(object sender, System.EventArgs e){
if(Page.IsValid){
// DO STUFF THERE IF THE PAGE IS VALID
}
}

You don't have to manually display the error messages; .Net validators will
automatically display them when the page renders.

"msuk" wrote:
All,

I have a ASP.NET/C# webform that contains a ASPRegularExpressionValidator
and a ASPRequiredFieldValidator, the form contains many fields to be filled
in. I have a send button at the bottom of the page that calls a function
within the webform that checks to see if the page is valid. If it is not a
label next the send button appears informing the user but if the page is
valid I would like to call a function in my code behind class is this
possible and how ?

Thanks
Msuk

Nov 18 '05 #3
Hi,

The click event in the code behind only fires once the page is valid, if I
move the click event to the actual aspx form I am not able to use all the
namespaces I need.

Is there no way to call a function in the code behind from the aspx form?

Thanks
Msuk

"Charles Chen" wrote:
You got it all wrong.

In the click event of the button, do something like this:

MyButton_Click(object sender, System.EventArgs e){
if(Page.IsValid){
// DO STUFF THERE IF THE PAGE IS VALID
}
}

You don't have to manually display the error messages; .Net validators will
automatically display them when the page renders.

"msuk" wrote:
All,

I have a ASP.NET/C# webform that contains a ASPRegularExpressionValidator
and a ASPRequiredFieldValidator, the form contains many fields to be filled
in. I have a send button at the bottom of the page that calls a function
within the webform that checks to see if the page is valid. If it is not a
label next the send button appears informing the user but if the page is
valid I would like to call a function in my code behind class is this
possible and how ?

Thanks
Msuk

Nov 18 '05 #4

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

Similar topics

2
by: moondaddy | last post by:
I'm using vb.net and have an aspx page where I want to call a function in the code behind to do something on the backend and I want to call this function from a jscript function in the aspx page. ...
3
by: DavidS | last post by:
Have parent.aspx from which I open Driver.aspx form via button on parent.aspx. When I first open the modal dialog, the driver.aspx Page_Load function is called. After I close the dialog, then...
2
by: Matthias H. | last post by:
Hi guys, Our team has a very strange problem. I hope anybody can help. We have a class called webpage and all our aspx-pages bases on it. Then we have a SYS.IO.File Class which have a...
6
by: Paolo Pignatelli | last post by:
I have an aspx code behind page that goes something like this in the HTML view: <asp:HyperLink id=HyperLink1 runat="server" NavigateUrl='<%#"mailto:" &amp;...
2
by: kermit | last post by:
I have a .net aspx page MyPage.aspx (client side) with code behind MyPage.aspx.vb (server side). I use the Page_Load event in MyPage.aspx.vb to load data into a multiteir class based...
2
by: Shapper | last post by:
Hello, I have an aspx page which in its script has: Sub Page_Load(...) ... End Sub And 2 functions:
2
by: anoop | last post by:
Hello, I created a Public class in .aspx.vb code behind file, now I want to know can I call that functions in the class in the Scripts either client side or server side in .aspx page. also I want...
14
by: Mark B | last post by:
Our webhost (www.usbusinessweb.net) had a W2K IIS5 server crash after a scheduled hard-boot occurred during a ms-security patch install overnight. They couldn't get the server working again so they...
6
by: SimonZ | last post by:
How can you call function from aspx page? For example: button on aspx page: <asp:button Visible="<% =funcVisible()%>" id="btnNew" Runat="server"></asp:button> code behind function:
11
by: Jan | last post by:
Hi, I defined a function like this: Public Function myfunction(ByVal myvar As Object) As String ... Return xyz End Function in aspx file, i use it like this:
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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,...

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.