This question is locked. New answers and comments are not allowed.
Hello,
I am trying to get an onload event to work within a grid for a textbox that I am rendering.
I have the following code within a grid:
columns.Template(o =>
{%>
<% String functionCall = String.Format("checkChanged({0},'{1}','{2}','{3}','{4}','{5}','{6}','{7}')", "this" , o.Active ? "true" : "false", o.Percentage, o.BlockAdSource, o.UrlOverride, o.GroupName, o.DomainName, o.EnablePercentage); %>
<% string functionPercentValidation = String.Format("validPercent({0},'{1}','{2}','{3}')", "this", o.UrlOverride, o.GroupName, o.DomainName); %>
<%= Html.TextBox(o.UrlOverride + o.GroupName + o.DomainName, o.Percentage, new { onload = functionCall, onkeypress = "return disableEnterKey(event)", onkeyup = functionPercentValidation })%>
<%}).Title("Percentage");
So when the text box is rendered I want to be able to tell it wheither it should be active or deactivated with the checkChanged function. I know that this function works as I have it implemented on a checkbox with an onClick event which will deactivate or activate the text box based on the checkbox's value. I have also changed the function to an onblur event, and this works fine this way, so this is how i know that it is the onload event that isn't working, not my javascript. I cannot seem to get this onload event to work? Any suggestions?
Thanks,
Daniel
I am trying to get an onload event to work within a grid for a textbox that I am rendering.
I have the following code within a grid:
columns.Template(o =>
{%>
<% String functionCall = String.Format("checkChanged({0},'{1}','{2}','{3}','{4}','{5}','{6}','{7}')", "this" , o.Active ? "true" : "false", o.Percentage, o.BlockAdSource, o.UrlOverride, o.GroupName, o.DomainName, o.EnablePercentage); %>
<% string functionPercentValidation = String.Format("validPercent({0},'{1}','{2}','{3}')", "this", o.UrlOverride, o.GroupName, o.DomainName); %>
<%= Html.TextBox(o.UrlOverride + o.GroupName + o.DomainName, o.Percentage, new { onload = functionCall, onkeypress = "return disableEnterKey(event)", onkeyup = functionPercentValidation })%>
<%}).Title("Percentage");
So when the text box is rendered I want to be able to tell it wheither it should be active or deactivated with the checkChanged function. I know that this function works as I have it implemented on a checkbox with an onClick event which will deactivate or activate the text box based on the checkbox's value. I have also changed the function to an onblur event, and this works fine this way, so this is how i know that it is the onload event that isn't working, not my javascript. I cannot seem to get this onload event to work? Any suggestions?
Thanks,
Daniel