simple async post back example

  • Thread starter Thread starter Yankee Imperialist Dog
  • Start date Start date
Y

Yankee Imperialist Dog

I need to do a simple asych post back to validate that an id is unique. I do
not want to post back the entire page for this, but i want to make this part
of the clientside validators.

1. i already have a custom validator that checks for a correctly formatted
id and the javascript works w/o problem.

Any help would be appreciated.
 
async postback is incompatiable with validators. validatiors are called to
cancel a postback, they can not wait around for the async return.

you could use an update panel, but this is really a full postback and page
process.

-- bruce (sqlwork.com)
 
thanks for replying,
(I think my description was off.)

I gues that's the point i want the validator to cancel the post back.
i have a customvalidator that uses the following script
<script language="JavaScript">
<!--
function CheckTrepID(sender, args)
{
var TrpID = args.Value;
var alphs = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
var nums = '0123456789';
if (TrpID.length != 10)
{
args.IsValid = false;
return;
}

for (var i=0;i<3; i++)
if ( alphs.indexOf(TrpID.charAt(i)) == -1)
{
args.IsValid = false;
return;
}
for (var i=3;i<11; i++)
if ( nums.indexOf(TrpID.charAt(i)) == -1)
{
args.IsValid = false;
return;
}
args.IsValid = true;
}
// -->
</script>

What i'd like to do is if the script see's that the new Trpid is correctly
formatted. to call a webservice with that Trpid and have the web service
return a bool saying if it exists. There has to be a way to do this. I just
can't find a simple example of how to do this.

Thanks
KES
 
you would need to do a sync webservice call not an async one (or async
callback). see the ms ajax toolkit or the jquery toolkit.

-- bruce (sqlwork.com)
 
Back
Top