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

javascript in usercontrol ascx file

3
i want to add a javascript validation in a ascx page. i have a checkbox and a textbox in this page, if user clicks the submit button without checking a box ,nor entering anything in the textbox, a alert message should be pop up.
I also have master page in the whole system.
Can anyone help me please?

Thank you soooo much.
Sep 23 '08 #1
3 4949
nateraaaa
663 Expert 512MB
I would create a .js file with your javascript code then reference the .js file in the head of each aspx page you want the javascript to run on.

<HEAD>
<script language="javascript" src="JavaScriptFile.js"></script>
</HEAD>

If you want the javascript code to be available to all of the aspx pages just reference the .js file in your Master page.

See the following thread if you want to add the .js file to your master page.
http://bytes.com/forum/thread574518.html

Nathan
Sep 23 '08 #2
nateraaaa
663 Expert 512MB
I would create a .js file with your javascript code then reference the .js file in the head of each aspx page you want the javascript to run on.

<HEAD>
<script language="javascript" src="JavaScriptFile.js"></script>
</HEAD>

If you want the javascript code to be available to all of the aspx pages just reference the .js file in your Master page.

See the following thread if you want to add the .js file to your master page.
http://bytes.com/forum/thread574518.html

Nathan
Sep 23 '08 #3
Frinavale
9,735 Expert Mod 8TB
All the information you need on controls that use JavaScript for client side validation and any other .NET controls can be found in the MSDN Library. This resource should get you pointed in the right direction....there are multiple articles on controls like the RequiredFieldValidator which will do client side validation for you. Be sure to look into how you can group controls into one validation group so that you don't have too many validation controls doing the same thing. I recommend bookmarking the MSDN Library and using it as your primary resource when developing in .NET.

Please take the time to research the problem before you post your question. The experts here are more than willing to help you with a specific problem but you have to do your part to learn the basics. Please take the time to read over the posting guidelines specifically the section on Before you post your question.

-Frinny
Sep 23 '08 #4

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

Similar topics

1
by: Michael Evanchik | last post by:
Tying not to spaghetti code which seems to be easy to do in .net, im trying to do my main .net html in index.aspx, use repeated .net html in an .ascx files and all code im doing in .vb code behind...
2
by: Ben de Vette | last post by:
Hi, I like to load a UserControl onto a placeholder with some more control then just doing protected System.Web.UI.WebControls.PlaceHolder placeHolder; UserControl ascx =...
2
by: Sascha | last post by:
Hi there, I searched carefully through the web before finally deciding to post this message, because I could not find a solution for my problem. Hopefully someone will have a hint or explanation...
12
by: Joe | last post by:
Hello All: Do I have to use the LoadControl method of the Page to load a UserControl? I have a class which contains three methods (one public and two private). The class acts as a control...
0
by: Arpan | last post by:
I have created the following UserControl (the file is named LoginForm.ascx): <script language=VB runat="server"> Public UName As String Public UPwd As String Public BColor As String Public...
0
by: acadam | last post by:
Hi, I have an userControl .ascx with a gridView control. One of the columns is a TemplateField with an HyperLink control. On the Row_DataBound event, I am checking that one of the other columns...
1
by: Nathan Sokalski | last post by:
I am revieving the following error for one of my controls when loading any pages that use it: Server Error in '/exposure/app' Application....
0
by: Jesper Lund Stocholm | last post by:
I have problems with sending javascript to the client from a dynamically loaded usercontrol. I have a single page that dynamically loads controls into a table cell in a HTML-table. For one of...
14
by: =?Utf-8?B?QWxleCBNYWdoZW4=?= | last post by:
Hi. I have created a UserControl ("MyUC"). I've put a bunch of instances of that control on a Page ("Defaul.aspx"). The control works fine. Now, I want to be able to use "FindControl()" from...
0
by: Nathan Sokalski | last post by:
I have several UserControls (*.ascx files) that I register in my Web.config file under the <system.web><pages><controlselement. If I mistype the src attribute in the Web.config file, the pages that...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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,...

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.