sir, i have a gridview in which i have 3 column:- ID,Number,Amount.
<asp:GridView ID="Gridview1" runat="server" AutoGenerateColumns="false" DataKeyNames="ID">
<Columns>
<asp:TemplateField Visible="false">
<ItemTemplate>
<asp:Label ID="LblFeeHeadOther" runat="server" Text='<%# Bind("ID") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField SortExpression="Amount" HeaderText="n(Amount)" HeaderStyle-Width="70px">
<ItemTemplate>
<asp:DropDownList ID="DdlMultiply" runat="server" AutoPostBack="true" OnSelectedIndexChanged="Multiply">
<asp:ListItem Value="1">1</asp:ListItem>
<asp:ListItem Value="2">2</asp:ListItem>
<asp:ListItem Value="3">3</asp:ListItem>
<asp:ListItem Value="4">4</asp:ListItem>
<asp:ListItem Value="5">5</asp:ListItem>
<asp:ListItem Value="6">6</asp:ListItem>
<asp:ListItem Value="7">7</asp:ListItem>
<asp:ListItem Value="8">8</asp:ListItem>
<asp:ListItem Value="9">9</asp:ListItem>
<asp:ListItem Value="10">10</asp:ListItem>
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField SortExpression="Amount" HeaderText="Amount" ItemStyle-HorizontalAlign="Right" HeaderStyle-HorizontalAlign="Right" HeaderStyle-Width="60px">
<ItemTemplate>
<asp:TextBox ID="TxtRecd" Text='<%# Bind("Amount") %>' runat="server" Width="100px" ></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
it look like after binding:-
ID -- Number -- Amount
101-- 1 -- 500
102-- 1 -- 700
it want that when i change dropdown then dropdown value multiply with amount and now amount are bind with new value. for example in first row i am select 5 in dropdown list then my gridview look like:-
ID -- Number -- Amount
101-- 5 -- 2500
102-- 1 -- 700
What I have tried:
its done fine in vb.net. but i want to do it with java script.
Protected Sub Multiply(ByVal sender As Object, ByVal e As EventArgs)
Dim row As GridViewRow = TryCast(TryCast(sender, DropDownList).NamingContainer, GridViewRow)
Dim dataKey As String = Me.Gridview1.DataKeys(row.RowIndex).Value.ToString()
Dim ClassesID As String = ViewState("ClassesID")
Dim amount As Integer = ViewState("amount")
Dim n As Integer = CType(GridOtherFee.Rows(row.RowIndex).FindControl("DdlMultiply"), DropDownList).SelectedValue
CType(row.FindControl("TxtRecd"), TextBox).Text = n * amount
End Sub