I have a gridview in which i have two textboxes. The senarios is such that the value I enter in one (txtCharges) should come as * 10 in the other textbox (txtTotalCharges). How to achieve this using javascript ? Markup code for gridview is as follows:
<asp:GridView ID="grdFixedMontlhy" CssClass="gridview" runat="server" AutoGenerateColumns="False"
Width="100%">
<RowStyle CssClass="gridviewItemStyle" HorizontalAlign="center" />
<Columns>
<asp:CheckBoxField Text="Select" />
<asp:BoundField DataField="Bill_HeadName" HeaderText="Head" />
<asp:BoundField DataField="Applicable_Charges_Category_Text" HeaderText="Type" />
<asp:TemplateField HeaderText="Charges" ItemStyle-CssClass="gridviewColumnControls">
<ItemTemplate>
<asp:TextBox ID="txtCharges" runat="server" Text='<%# Bind("Charges") %>'></asp:TextBox>
<asp:FilteredTextBoxExtender ID="txtCharges_FilteredTextBoxExtender" runat="server"
Enabled="True" TargetControlID="txtCharges" ValidChars="0123456789.">
</asp:FilteredTextBoxExtender>
</ItemTemplate>
<ItemStyle CssClass="gridviewColumnControls" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Days" ItemStyle-CssClass="gridviewColumnControls">
<asp:TemplateField HeaderText="Total Charges" ItemStyle-CssClass="gridviewColumnControls">
<itemtemplate>
<asp:TextBox ID="txtTotalCharges" runat="server" Text=""></asp:TextBox>
<asp:FilteredTextBoxExtender ID="txtTotalCharges_FilteredTextBoxExtender"
runat="server" Enabled="True" TargetControlID="txtTotalCharges"
ValidChars="0123456789.">
</asp:FilteredTextBoxExtender>
</itemtemplate>
<itemstyle cssclass="gridviewColumnControls" />
</asp:TemplateField>
</Columns>
</asp:GridView>
Thanks in advance.
fail … lack of understanding above …
put the script on the page that suryakiran suggests (with a slight alteration) …
as an attribute for the txtCharges box.
that way each rows dynamic id for the total box is passed in to the js on the client when it’s called.