Question on Ajax vs. plain javascript

  • Thread starter Thread starter Bill Gower
  • Start date Start date
B

Bill Gower

I have a asp.net form where if the user checks a check box I need to disable
some of the fields. I don't need to make a trip to the server for anything
at this point so is this is a case of using javascript to disable the fields
or should I be using Ajax do that? As probably can be seen from my post I
have never used Ajax yet.

Bill
 
Bill,

You may consider Ajax only if you need to immediately react to the checks.
Since you don't, all you need to do is to make sure that the checkbox's
AutoPostBack property is not set to true and your server-side app will pick
up the values on the next postback.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
 
So you are saying to just use Javascript to disable the controls that need
to be?

Bill

Eliyahu Goldin said:
Bill,

You may consider Ajax only if you need to immediately react to the checks.
Since you don't, all you need to do is to make sure that the checkbox's
AutoPostBack property is not set to true and your server-side app will
pick up the values on the next postback.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net


Bill Gower said:
I have a asp.net form where if the user checks a check box I need to
disable some of the fields. I don't need to make a trip to the server for
anything at this point so is this is a case of using javascript to disable
the fields or should I be using Ajax do that? As probably can be seen
from my post I have never used Ajax yet.

Bill
 
What do you want to disable the controls for?

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net


Bill Gower said:
So you are saying to just use Javascript to disable the controls that need
to be?

Bill

Eliyahu Goldin said:
Bill,

You may consider Ajax only if you need to immediately react to the
checks. Since you don't, all you need to do is to make sure that the
checkbox's AutoPostBack property is not set to true and your server-side
app will pick up the values on the next postback.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net


Bill Gower said:
I have a asp.net form where if the user checks a check box I need to
disable some of the fields. I don't need to make a trip to the server
for anything at this point so is this is a case of using javascript to
disable the fields or should I be using Ajax do that? As probably can be
seen from my post I have never used Ajax yet.

Bill
 
as you mentioned you dont need to make a trip to the server to disable some
fields.so dont.
here partial update will make no sense.
 
Because they are not applicable if the checkbox is checked.

Bill

Eliyahu Goldin said:
What do you want to disable the controls for?

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net


Bill Gower said:
So you are saying to just use Javascript to disable the controls that
need to be?

Bill

Eliyahu Goldin said:
Bill,

You may consider Ajax only if you need to immediately react to the
checks. Since you don't, all you need to do is to make sure that the
checkbox's AutoPostBack property is not set to true and your server-side
app will pick up the values on the next postback.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net


I have a asp.net form where if the user checks a check box I need to
disable some of the fields. I don't need to make a trip to the server
for anything at this point so is this is a case of using javascript to
disable the fields or should I be using Ajax do that? As probably can
be seen from my post I have never used Ajax yet.

Bill
 
Then yes, your best option is client-side disabling with javascript.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net


Bill Gower said:
Because they are not applicable if the checkbox is checked.

Bill

Eliyahu Goldin said:
What do you want to disable the controls for?

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net


Bill Gower said:
So you are saying to just use Javascript to disable the controls that
need to be?

Bill

message Bill,

You may consider Ajax only if you need to immediately react to the
checks. Since you don't, all you need to do is to make sure that the
checkbox's AutoPostBack property is not set to true and your
server-side app will pick up the values on the next postback.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net


I have a asp.net form where if the user checks a check box I need to
disable some of the fields. I don't need to make a trip to the server
for anything at this point so is this is a case of using javascript to
disable the fields or should I be using Ajax do that? As probably can
be seen from my post I have never used Ajax yet.

Bill
 
I'd suggest using JavaScript in this case.
No need for AJAX here.
 
Back
Top