Mohan

Mohan

  • 1.6k
  • 27
  • 2k

asp.net textbox clientside lost focus event in listview control

May 27 2024 4:35 AM

I have below lines of code in asp:list view control, if user input any value on 2nd text box, on client side lost focus event I need to calculate txtTokensReq * txtQty and display in lblTotalTokens.

WHen I wrote onblur function on 2nd textbox, it is firing more than once.

Thanks in advance.

<asp:ListView runat="server" ID="lstView" ClientIDMode="Static" GroupItemCount="1" 
OnItemDataBound="lstView_ItemDataBound">
<asp:TextBox runat="server" CssClass="inputQty" MaxLength="5" ID="txtTokensReq" 
ClientIDMode="Static" Text='<%# Eval("PartToken")%>' ReadOnly="true"></asp:TextBox>
<asp:TextBox runat="server" cssClass="inputQty" MaxLength="5" ID="txtQty" Text='<%# Eval("Qty")%>' 
onKeypress ="if(!validatenumeric(this,5)){return false;}"></asp:TextBox>
<asp:Label ID="lblTotalTokens" CssClass="note-maxqty col-last" Text='<%# Eval("TotalTokenReq")%>' 
runat="server"></asp:Label>
</asp:ListView>

Answers (6)