Hello i have one Repeater Control
<asp:Repeater ID="rptCashCome" runat="server">
<ItemTemplate>
<asp:TextBox ID="txtCurrencyNo" onkeyup="javascript:CallFunction()" CssClass="mws-textinput" runat="server"></asp:TextBox>
<asp:TextBox ReadOnly="True" ID="txtTotal" CssClass="mws-textinput" runat="server"></asp:TextBox>
</ItemTemplate>
</asp:Repeater>
I have a Jquery Function
function CallFunction() {
//code here i want something like. txtCurrencyNo* 500 = txtTotal
// something like calculative here. but how will i find the Control ID of repeater ?
}
This function is Called. but how do i do calculation based on textbox KeyUp ? how will i find the control ID here ?
you can user jQuery for this.
use
$(this).val()
It will give you the value of the current text box.
If the other text box is in the same template then you can use like this (not tested)
function CallFunction() {
var firstTextBoxVal= $(this).val();
$(this).next().val(firstTextBoxVal* 500 )
}
change your repeater as follows
<asp:Repeater ID="rptCashCome" runat="server">
<ItemTemplate>
<asp:TextBox ID="txtCurrencyNo" onkeyup="javascript:CallFunction(this)" CssClass="mws-textinput" runat="server"></asp:TextBox>
<asp:TextBox ReadOnly="True" ID="txtTotal" CssClass="mws-textinput" runat="server"></asp:TextBox>
</ItemTemplate>
</asp:Repeater>