I believe I saw it somewhere here already but I can't find it.
Given that I have a textbox in the Edit Template of my DataGrid, I want to add a Javascript to one of it's events.
I am trying to use the javascript code "getElementById"
but even if I use the UniqueID, it seems like it cannot find it (even if the datagrid is in edit mode)
any hints on how to accomplish this? here is my code:
StringBuilder product = new StringBuilder();
product.Append("<Script Language=javascript>"
product.Append("function Recalculate() {"
product.Append("document.getElementById('"
product.Append(txbTotal.UniqueID);
product.Append("').value = document.getElementById('"
product.Append(txbQuantity.UniqueID);
product.Append("').value * document.getElementById('"
product.Append(txbPrice.UniqueID);
product.Append("').value"
product.Append("}"
product.Append("</Script>"
RegisterStartupScript("Product", product.ToString());
txbQuantity.Attributes.Add("OnChange", "javascript:Recalculate()"
txbPrice.Attributes.Add("OnChange", "javascript:Recalculate()"
thanks!! Daren J. Lahey
Just another computer guy...
If you are unsure of forum etiquette check here FAQ796-2540
Given that I have a textbox in the Edit Template of my DataGrid, I want to add a Javascript to one of it's events.
I am trying to use the javascript code "getElementById"
but even if I use the UniqueID, it seems like it cannot find it (even if the datagrid is in edit mode)
any hints on how to accomplish this? here is my code:
StringBuilder product = new StringBuilder();
product.Append("<Script Language=javascript>"
product.Append("function Recalculate() {"
product.Append("document.getElementById('"
product.Append(txbTotal.UniqueID);
product.Append("').value = document.getElementById('"
product.Append(txbQuantity.UniqueID);
product.Append("').value * document.getElementById('"
product.Append(txbPrice.UniqueID);
product.Append("').value"
product.Append("}"
product.Append("</Script>"
RegisterStartupScript("Product", product.ToString());
txbQuantity.Attributes.Add("OnChange", "javascript:Recalculate()"
txbPrice.Attributes.Add("OnChange", "javascript:Recalculate()"
thanks!! Daren J. Lahey
Just another computer guy...
If you are unsure of forum etiquette check here FAQ796-2540