<asp:GridView ID="GridView5" runat="server" CellPadding="4"
EnableModelValidation="True" Width="1115px" AutoGenerateColumns="False"
BackColor="White" BorderColor="#3366CC" BorderStyle="None" BorderWidth="1px">
<FooterStyle BackColor="#99CCCC" ForeColor="#003399" />
<HeaderStyle BackColor="#003399" Font-Bold="True" ForeColor="#CCCCFF" />
<PagerStyle BackColor="#99CCCC" ForeColor="#003399" HorizontalAlign="Left" />
<RowStyle BackColor="White" ForeColor="#003399" />
<SelectedRowStyle BackColor="#009999" Font-Bold="True" ForeColor="#CCFF99" />
<Columns>
<asp:TemplateField HeaderText="ID">
<ItemTemplate>
<asp:Label ID="CId3" runat="server" Text=''> </asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Student Name">
<ItemTemplate>
<asp:Label ID="CName3" runat="server" Text='' Width="120"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Return">
<ItemTemplate>
<asp:TextBox ID="TextBox36" runat="server" Width="60px"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="1Mile/800 Meter">
<ItemTemplate>
<asp:TextBox ID="TextBox37" runat="server" Width="60px">
</asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Marks">
<ItemTemplate>
<asp:TextBox ID="TextBox38" runat="server" Width="60px" >
</asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Long Jump">
<ItemTemplate>
<asp:TextBox ID="TextBox39" runat="server" Width="60px"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Marks">
<ItemTemplate>
<asp:TextBox ID="TextBox40" runat="server" Width="60px"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="High Jump">
<ItemTemplate>
<asp:TextBox ID="TextBox41" runat="server" Width="60px"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Mark">
<ItemTemplate>
<asp:TextBox ID="TextBox42" runat="server" Width="60px">
</asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Interview">
<ItemTemplate>
<asp:TextBox ID="TextBox43" runat="server" Width="60px"
onblur="validateField3(this)">
</asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Total">
<ItemTemplate>
<asp:TextBox ID="TextBox44" runat="server" Width="60px" Enabled="false">
</asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
Codes for JavaScript:-
Codes for JavaScript:-
function validateField3(fieldname)
{
if ((fieldname.value) && (!fieldname.value.match(" ")))
{
var str = fieldname.id1;
document.getElementById(fieldname.id.replace("43", "44")).value =
parseInt(document.getElementById(fieldname.id.replace("43", "36")).value) +
parseInt(document.getElementById(fieldname.id.replace("43", "38")).value) +
parseInt(document.getElementById(fieldname.id.replace("43", "40")).value) +
parseInt(document.getElementById(fieldname.id.replace("43", "42")).value) +
parseInt(document.getElementById(fieldname.id.replace("43", "43")).value);
}
}
</script>
Data bind:-
protected void Button3_Click(object sender, EventArgs e)
{
DataAccess da = new DataAccess(); da.OpenConnection(); string id; foreach (GridViewRow row in GridView5.Rows) { string c = ddmonth.SelectedValue.ToString() + "/" + ddday.SelectedValue.ToString() + "/" + ddyear.SelectedValue.ToString(); id = ((Label)row.FindControl("Cid3")).Text; TextBox text36 = (TextBox)row.FindControl("TextBox36"); TextBox text37 = (TextBox)row.FindControl("TextBox37"); TextBox text38 = (TextBox)row.FindControl("TextBox38"); TextBox text39 = (TextBox)row.FindControl("TextBox39"); TextBox text40 = (TextBox)row.FindControl("TextBox40"); TextBox text41 = (TextBox)row.FindControl("TextBox41"); TextBox text42 = (TextBox)row.FindControl("TextBox42"); TextBox text43 = (TextBox)row.FindControl("TextBox43"); TextBox text44 = (TextBox)row.FindControl("TextBox44"); if (text36 .Text !="" && text37 .Text !="" && text38 .Text !="" && text39 .Text !="" && text40 .Text !="" && text41 .Text !="" && text42 .Text !="" && text43 .Text !="") { try { double sa = (double.Parse(text36.Text) + double.Parse(text38.Text) + double.Parse(text40.Text) + double.Parse(text42.Text) + double.Parse(text43.Text)); da.ExecuteNonQuery("Insert into PhysicalPractice(id,pdate,Rtnmarks,Atasemeter,mark1,Longjump,mark4,Highjump,mark5,interview,total) values('" + id + "','" + c + "','" +text36 .Text + "','" +text37 .Text + "','" +text38 .Text + "','" +text39 .Text + "','" +text40 .Text + "','" +text41 .Text + "','" +text42 .Text + "','" +text43 .Text + "','" + sa.ToString() + "')"); lbl_msg4.Text = "Record Save successfully"; } catch (Exception ex) { Response.Write(ex.Message); } } else { lbl_msg4.Text = "Please enter all inforamation"; }
} }
}
protected void Button3_Click(object sender, EventArgs e)
{
DataAccess da = new DataAccess();
da.OpenConnection();
string id;
foreach (GridViewRow row in GridView5.Rows)
{
string c = ddmonth.SelectedValue.ToString() + "/"
+ ddday.SelectedValue.ToString() + "/"
+ ddyear.SelectedValue.ToString();
id = ((Label)row.FindControl("Cid3")).Text;
TextBox text36 = (TextBox)row.FindControl("TextBox36");
TextBox text37 = (TextBox)row.FindControl("TextBox37");
TextBox text38 = (TextBox)row.FindControl("TextBox38");
TextBox text39 = (TextBox)row.FindControl("TextBox39");
TextBox text40 = (TextBox)row.FindControl("TextBox40");
TextBox text41 = (TextBox)row.FindControl("TextBox41");
TextBox text42 = (TextBox)row.FindControl("TextBox42");
TextBox text43 = (TextBox)row.FindControl("TextBox43");
TextBox text44 = (TextBox)row.FindControl("TextBox44");
if (text36 .Text !="" && text37 .Text !="" && text38 .Text !="" && text39 .Text !="" && text40 .Text !="" && text41 .Text !="" && text42 .Text !="" && text43 .Text !="")
{
try
{
double sa = (double.Parse(text36.Text) + double.Parse(text38.Text) + double.Parse(text40.Text) + double.Parse(text42.Text) + double.Parse(text43.Text));
da.ExecuteNonQuery("Insert into PhysicalPractice(id,pdate,Rtnmarks,Atasemeter,mark1,Longjump,mark4,Highjump,mark5,interview,total) values('" + id + "','" + c + "','" +text36 .Text + "','" +text37 .Text + "','" +text38 .Text + "','" +text39 .Text + "','" +text40 .Text + "','" +text41 .Text + "','" +text42 .Text + "','" +text43 .Text + "','" + sa.ToString() + "')");
lbl_msg4.Text = "Record Save successfully";
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
}
else
{
lbl_msg4.Text = "Please enter all inforamation";
}
}
}
}
0 Comments Received
Leave A Reply