Question on Ajax vs. plain javascript

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
 
E

Eliyahu Goldin

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
 
B

Bill Gower

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
 
E

Eliyahu Goldin

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
 
C

chenhong

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.
 
B

Bill Gower

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
 
E

Eliyahu Goldin

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
 
S

Steve C. Orr [MCSD, MVP, CSM, ASP Insider]

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top