Question

I have an input element in my aspx page.

<input id="txtAllocAmt" type="text" class="txtAllocAmt" tabindex="2" size="10" name="Text1"
                       runat="server" disabled="disabled" onfocus="javascript:SetOldAllocAmt(this.id);"
                    onblur="ValidateAllocAmt(this.id);" />

The problem is that for some reason, javascript calls for both "onfocus" and "onblur" doesn't show up when the code is running as shown below.

<input onblur="" onfocus="" id="lvLienAllocations_ctrl0_ctl00_txtAllocAmt" class="txtAllocAmt"  tabIndex="2" name="lvLienAllocations$ctrl0$ctl00$txtAllocAmt" size="10" type="text">

For some reason "onblur" and "onfocus" are set to an empty string.

What is preventing asp.net code generator from generating those javascript calls?

Was it helpful?

Solution

Either remove runat=server, or add The events in code behind:

lvLienAllocations.Attributes.Add("onblur", "javascript:SetOldAllocAmt(" + lvLienAllocations.ClientID + ")";
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top