473,387 Members | 3,750 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,387 software developers and data experts.

Disable entire asp.net form (using vb.net)

I have an asp.net page say page1.aspx. The form in html code is <form
id = "Form1">
And i want to disable all the fields of the form after some code steps.
I had created a javascript funct:

function disable()
{
alert("Forms length is :" + Form1.length);
for (i = 0; i < Form1.length; i++) {
var formElement = Form1.elements[i];
if (true) {
formElement.disabled = true;
}
}
}

And it can be invoked in events like 'onClick'..

As i need to call it from my asp.net code, I can use
button1.attributes.add("onClick","disable()")

But i dont want to call it on event, in fact i want my page to do some
steps and then on some condition, disable it.

Ne other suggestions are also welcomed!!

TIA,

Feb 3 '06 #1
4 3103
You want your page to "do some steps" and then on some condition, disable
it...

Is the "do some steps" stuff when the page loads? In which case you can tie
the "do some steps" code to the body.onload event, and have it call
disable( ) if need be.

Does that help?

Kevin

"Chris" <ch***********@gmail.com> wrote in message
news:11*********************@g47g2000cwa.googlegro ups.com...
I have an asp.net page say page1.aspx. The form in html code is <form
id = "Form1">
And i want to disable all the fields of the form after some code steps.
I had created a javascript funct:

function disable()
{
alert("Forms length is :" + Form1.length);
for (i = 0; i < Form1.length; i++) {
var formElement = Form1.elements[i];
if (true) {
formElement.disabled = true;
}
}
}

And it can be invoked in events like 'onClick'..

As i need to call it from my asp.net code, I can use
button1.attributes.add("onClick","disable()")

But i dont want to call it on event, in fact i want my page to do some
steps and then on some condition, disable it.

Ne other suggestions are also welcomed!!

TIA,

Feb 3 '06 #2
Thnx Kevin,
Yep, its in the page load event. It fetches some values, and then later
on on some specific condition, may have to disable the form.

How do i call this disable function ? Its a javascript function.

Thnx..

Kevin Frey wrote:
You want your page to "do some steps" and then on some condition, disable
it...

Is the "do some steps" stuff when the page loads? In which case you can tie
the "do some steps" code to the body.onload event, and have it call
disable( ) if need be.

Does that help?

Kevin

"Chris" <ch***********@gmail.com> wrote in message
news:11*********************@g47g2000cwa.googlegro ups.com...
I have an asp.net page say page1.aspx. The form in html code is <form
id = "Form1">
And i want to disable all the fields of the form after some code steps.
I had created a javascript funct:

function disable()
{
alert("Forms length is :" + Form1.length);
for (i = 0; i < Form1.length; i++) {
var formElement = Form1.elements[i];
if (true) {
formElement.disabled = true;
}
}
}

And it can be invoked in events like 'onClick'..

As i need to call it from my asp.net code, I can use
button1.attributes.add("onClick","disable()")

But i dont want to call it on event, in fact i want my page to do some
steps and then on some condition, disable it.

Ne other suggestions are also welcomed!!

TIA,


Feb 3 '06 #3
...And in the function 'Form1' is the html form. So when i try to use it
in 'RegisterStartupScript' , its not recognised.

How can i access the function in html, from asp.net (using vb.net)?

Feb 3 '06 #4
Got it buddy!!
Thanks for ur help!!

Feb 3 '06 #5

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

Similar topics

1
by: Paul Oakfleet | last post by:
The script below will disable Submit button until user accept terms, and will redirect user to another page after clicking on Submit button. The script seems to work fine on my PC (Windows XP,...
14
by: Sinity | last post by:
Anyone knows the method/codes to disable the clicked button after first click by using .aspx-- to prevent people to click many time when waiting for the server response. I tried to do this by...
7
by: nicholas | last post by:
how can I disable a button when the user clicks on it and the webform is validated. I want this to prevent the user from clicking twice and by this submitting the form twice. Thank you. ...
13
by: steven | last post by:
A monthcalendar checks every 2 minutes if theres a new day. Does anyone knows how to disable this ? The problem is that, everytime a monthcalendar checks this, the form where the monhcalendar is...
0
by: Ahmad Jalil Qarshi | last post by:
Hi! I have a problem while developing some webpages.The Problem is that:- How We Can Disable The Controls Of One Web Form From Other Web Form In Asp.net? Explanation:- There Should Be Two...
3
by: FOGARTYR | last post by:
I cannot find a way to disable an entire form. I need to disable the entire form during certain time periods, but I cannot find a way to do so...please help
5
by: ApexData | last post by:
I have a Continuous SubForm on a TabPage. Above the ContinuousForm is a "box of fields" I use to display the entire record that the focus is on. When one points to a record using the...
9
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I disable the right mouse button? -----------------------------------------------------------------------...
6
by: Brandon McCombs | last post by:
Hello, I have a form that contains a listview on the left side and a column of buttons on the right side. Only some of the buttons do I want enabled all the time. The other buttons should be...
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: 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
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
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
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...

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.