467,178 Members | 1,323 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,178 developers. It's quick & easy.

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
  • viewed: 2827
Share:
4 Replies
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

14 posts views Thread by Sinity | last post: by
7 posts views Thread by nicholas | last post: by
13 posts views Thread by steven | last post: by
reply views Thread by Ahmad Jalil Qarshi | last post: by
5 posts views Thread by ApexData@gmail.com | last post: by
6 posts views Thread by Brandon McCombs | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.