ASP:Reader client side totally

  • Thread starter Thread starter owen79
  • Start date Start date
O

owen79

Hi,

I have a repeater on a asp.net (c#) page that holds the details of
daily bed occupancy for a hostpital ward for any given date. For each
hostpital there are a number of wards. So a hostiptal with 5 wards has
5 elements each containing a textbox for occupied and another for
remaining available.
As the user cycles through the txtboxs I want to catch the textchanged
and add all the occupied values together and the same with the
available. I tried plain old postback but it interferes with the data
input for the user. I need to do it client side but I can't work out
how I cycle through each textbox and work out if it is a occupied or
available box. All txtboxs on in the repeater need evaluating at the
same time incase any of them are changed again following error.

Any susggests or direction to a more appropriate group would be
gratefully recieved.

Thanks

Owen
 
you need to learn javascript and the browser dom. your local bookstore
should have several books.

you need some way for the client script to find the textboxes, sometime in
the name, add an additional attribute. you probably want to call you client
routine on the onblur, and on submit. making a client validation control
makes sense.

if you put _OC_ in the occupied names and _AV_ in the avaliable you could
(air code):

function sumWards()
{
for (int i=0; i < document.forms[0].elments.length; ++i)
{
var totOC = 0;
var totAV = 0;
el = document.forms[0].elments;
if ((el.name + '').indexOf('_OC_') >= 0)
totOC += el.value;
if ((el.name + '').indexOf('_AV_') >= 0)
totAV += el.value;
}
}

-- bruce (sqlwork.com)
 
Back
Top