From: aspfun via DotNetMonster.com on
I am new in Javascripts.

I want to code javascripts to check some text boxes value in code behind form.
(I knew how to use vb to check but in this case, I need JS)

Can someone help me?

For example, I want to use js to check value in txtOrderProduct, txtOrderBy,
if both of text boxes are blank then fire alert function.

--
Message posted via http://www.dotnetmonster.com

From: Mark Rae [MVP] on
"aspfun via DotNetMonster.com" <u53138(a)uwe> wrote in message
news:a45c91a52bfd1(a)uwe...

> I want to code a JavaScript to check the value of some text boxes in code
behind form.

Firstly, JavaScript runs locally in the browser on the client-side, not in
the code-behind which runs remotely on the server side. So your statement
above is not possible.


> For example, I want to use js to check value in txtOrderProduct,
> txtOrderBy,
> if both of text boxes are blank then fire alert function.

<script type="text/javascript">
if
((document.getElementById('<%=txtOrderProduct.ClientID%>').value.length ==
0) && (document.getElementById('<%=txtOrderBy.ClientID%>').value.length ==
0))
{
alert('Some alert');
}
</script>

However, this will not run in code-behind...


--
Mark Rae
ASP.NET MVP
http://www.markrae.net