<script type="text/javascript">
function calculate()
{
var total = document.getElementById('<%=ttt.ClientID %>').value;
for (var i = 2; i < total + 2; i++)
{
if (i < 10)
{
var t1 = document.getElementById("<%=TextBox1.ClientID %>").value;
var t2 = document.getElementById("<%=TextBox2.ClientID %>").value;
var t3 = document.getElementById("<%=TextBox3.ClientID %>").value;
var max = document.getElementById('ctl00_ContentPlaceHolder1_GridView1_ctl0'+i+'_TextBox11').value;
var mx = parseInt(max);
var t11 = parseInt(max) * parseInt(t1) / 100;
var t22 = parseInt(max) * parseInt(t2) / 100;
var t33 = parseInt(max) * parseInt(t3) / 100;
var to = t11 + t22 + t33;
var comp = mx - to;
document.getElementById('ctl00_ContentPlaceHolder1_GridView1_ctl0' + i + '_TextBox12').value = t11;
document.getElementById('ctl00_ContentPlaceHolder1_GridView1_ctl0' + i + '_TextBox13').value = t22;
document.getElementById('ctl00_ContentPlaceHolder1_GridView1_ctl0' + i + '_TextBox14').value = t33;
document.getElementById('ctl00_ContentPlaceHolder1_GridView1_ctl0' + i + '_TextBox15').value = comp;
}
}
return false;
}
</script>
HTML------------------------------------------------------
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
Width="880px">
<Columns>
<asp:TemplateField HeaderText="id">
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("id") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="TextBox8" runat="server" Text='<%# Bind("id") %>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="name">
<ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%# Bind("name") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="TextBox9" runat="server" Text='<%# Bind("name") %>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="max">
<ItemTemplate>
<asp:TextBox ID="TextBox11" runat="server" Width="69px" Text='<%# Bind("max") %>'></asp:TextBox>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="TextBox10" runat="server" Text='<%# Bind("max") %>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="md">
<ItemTemplate>
<asp:TextBox ID="TextBox12" runat="server" Width="69px" Text='<%# Bind("p1") %>' onchange="return onkeytextbox();"></asp:TextBox>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="TextBox4" runat="server" Text='<%# Bind("p1") %>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="ag">
<ItemTemplate>
<asp:TextBox ID="TextBox13" runat="server" Width="69px" Text='<%# Bind("p2") %>' onchange="return onkeytextbox();"></asp:TextBox>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="TextBox5" runat="server" Text='<%# Bind("p2") %>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="ds">
<ItemTemplate>
<asp:TextBox ID="TextBox14" runat="server" Width="69px" Text='<%# Bind("p3") %>' onchange="return onkeytextbox();"></asp:TextBox>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="TextBox6" runat="server" Text='<%# Bind("p3") %>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="com">
<ItemTemplate>
<asp:TextBox ID="TextBox15" runat="server" Width="69px" Text='<%# Bind("com") %>'></asp:TextBox>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="TextBox7" runat="server" Text='<%# Bind("com") %>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:HiddenField ID="ttt" runat="server" />
No comments:
Post a Comment