Monday, March 26, 2012

Mixing client-side and server-side processing: How?

Hi All,

I just picked up an ASP.NET "Mortgage Calculator" example with
code-behind from Prosise's 2002 "Programming Microsoft.NET". Works
great. User enters a few values, clicks button, and monthy payment is
displayed.

When I design apps like this, I like to clear out result fields like
"monthly payment" the minute the user changes any of the parameters of
the mortgage. Doing that server-side looks easy enough, but I'd want
to do it client-side in a real, business app.

So how can I add trapping of onchange events to the asp fields for
client-side processing?

Regards,
RichardThe easiest way would be to generate client-side JavaScript and add it using
the RegisterClientScriptBlock() method and the Attributes.Add() method. I
can't really tell you exactly what the code should look like since I haven't
seen your current code, but if you have ever used JavaScript before it
shouldn't be hard to figure out. Good Luck!
--
Nathan Sokalski
njsokalski@.hotmail.com
http://www.nathansokalski.com/

"Richard" <RichardDummyMailbox58407@.USComputerGurus.com> wrote in message
news:1147373924.287992.239030@.i39g2000cwa.googlegr oups.com...
> Hi All,
> I just picked up an ASP.NET "Mortgage Calculator" example with
> code-behind from Prosise's 2002 "Programming Microsoft.NET". Works
> great. User enters a few values, clicks button, and monthy payment is
> displayed.
> When I design apps like this, I like to clear out result fields like
> "monthly payment" the minute the user changes any of the parameters of
> the mortgage. Doing that server-side looks easy enough, but I'd want
> to do it client-side in a real, business app.
> So how can I add trapping of onchange events to the asp fields for
> client-side processing?
> Regards,
> Richard
Hi Nathan,

Thanks a lot. I agree: I should be able to figure it out, which I'll
try to do this weekend.

Best wishes,
Richard

Nathan Sokalski wrote:
> The easiest way would be to generate client-side JavaScript and add it using
> the RegisterClientScriptBlock() method and the Attributes.Add() method. I
> can't really tell you exactly what the code should look like since I haven't
> seen your current code, but if you have ever used JavaScript before it
> shouldn't be hard to figure out. Good Luck!
> --
> Nathan Sokalski
> njsokalski@.hotmail.com
> http://www.nathansokalski.com/
> "Richard" <RichardDummyMailbox58407@.USComputerGurus.com> wrote in message
> news:1147373924.287992.239030@.i39g2000cwa.googlegr oups.com...
> > Hi All,
> > I just picked up an ASP.NET "Mortgage Calculator" example with
> > code-behind from Prosise's 2002 "Programming Microsoft.NET". Works
> > great. User enters a few values, clicks button, and monthy payment is
> > displayed.
> > When I design apps like this, I like to clear out result fields like
> > "monthly payment" the minute the user changes any of the parameters of
> > the mortgage. Doing that server-side looks easy enough, but I'd want
> > to do it client-side in a real, business app.
> > So how can I add trapping of onchange events to the asp fields for
> > client-side processing?
> > Regards,
> > Richard

0 comments:

Post a Comment