Angular 12 CRUD Example
In this article, we will learn angular 12 CRUD example with web API as well as way to implement cascading dropdown, searching, sorting, and pagination...
May 30, 2021 read moreIn this article, we will learn angular 12 CRUD example with web API as well as way to implement cascading dropdown, searching, sorting, and pagination...
May 30, 2021 read moreIn this article i am going to explain how you can use angular js table with bootstrap 4 in asp.net web form, and also show you how you can display records...
December 08, 2018 read moreCodingvila also allowing a guest post for digital marketing, where you can explore your business, product, or services in terms of articles. write quality.......
August, 21, 2021 read moreIn this article, we will learn how to create a bar chart in angular 12 using ng2-charts. Here, I'll explain how to create an angular 12 project in visual........
May 29, 2021 read moreThis article gives an explanation about convert Datatable to CSV in c# and explains the efficient way to write CSV files from Datatable as well as show...
March 01, 2020 read moreThis article provides an explanation about how to merge multiple pdf files into single pdf in using Itextsharp in c# here I also explained the use of Itextsharp.
January 22, 2019 read more<head runat="server"> <title></title> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css" /> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"></script> </head>
<body> <form id="form1" runat="server"> <div class="container"> <div class="form-row"> <br /> <div class="form-group col-md-12"> <center><h2>Employee Details</h2></center> </div> </div> <div class="form-row"> <div class="form-group col-md-12"> <label for="inputCity">Company Name</label> <asp:TextBox ID="txtCompany" runat="server" CssClass="form-control" placeholder="Company Name" aria-label="Company"></asp:TextBox> </div> <div class="form-group col-md-4"> <label for="inputCity">EmployeeCode</label> <asp:TextBox ID="txtEmployeeCode" runat="server" CssClass="form-control" placeholder="Employee Code" aria-label="EmployeeCode"></asp:TextBox> </div> <div class="form-group col-md-4"> <label for="inputCity">FirstName</label> <asp:TextBox ID="txtFirstName" runat="server" CssClass="form-control" placeholder="First Name" aria-label="FirstName"></asp:TextBox> </div> <div class="form-group col-md-4"> <label for="inputCity">LastName</label> <asp:TextBox ID="txtLastName" runat="server" CssClass="form-control" placeholder="Last Name" aria-label="LastName"></asp:TextBox> </div> <div class="form-group col-md-4"> <label for="inputCity">Department</label> <asp:TextBox ID="txtDepartment" runat="server" CssClass="form-control" placeholder="Department" aria-label="Department"></asp:TextBox> </div> <div class="form-group col-md-4"> <label for="inputCity">Designation</label> <asp:TextBox ID="txtDesignation" runat="server" CssClass="form-control" placeholder="Designation" aria-label="Designation"></asp:TextBox> </div> <div class="form-group col-md-4"> <label for="inputCity">Blood Group</label> <asp:TextBox ID="txtBloodgroup" runat="server" CssClass="form-control" placeholder="Blood Group" aria-label="BloodGroup"></asp:TextBox> </div> <div class="form-group col-md-2"> <asp:Button ID="btnInsert" runat="server" CssClass="btn btn-success" Text="Insert Record" OnClick="btnInsert_Click" /> </div> <div class="form-group col-md-12"> <div class="panel panel-default "> <div class="panel-heading">Employee Grid</div> <div class="panel-body"> <asp:GridView ID="grdEmployees" runat="server" CssClass="table table-bordered active active" AutoGenerateColumns="false" EmptyDataText="No records has been found."> <Columns> <asp:BoundField DataField="Company" HeaderText="Company" ItemStyle-Width="120" /> <asp:BoundField DataField="EmployeeCode" HeaderText="EmployeeCode" ItemStyle-Width="120" /> <asp:BoundField DataField="FirstName" HeaderText="FirstName" ItemStyle-Width="120" /> <asp:BoundField DataField="LastName" HeaderText="LastName" ItemStyle-Width="120" /> <asp:BoundField DataField="Department" HeaderText="Department" ItemStyle-Width="150" /> <asp:BoundField DataField="Designation" HeaderText="Designation" ItemStyle-Width="120" /> <asp:BoundField DataField="BloodGroup" HeaderText="BloodGroup" ItemStyle-Width="70" /> </Columns> </asp:GridView> </div> </div> </div> </div> </div> </form> </body>
using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class CS : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) { DataTable dt = new DataTable(); dt.Columns.AddRange(new DataColumn[7] { new DataColumn("Company"), new DataColumn("EmployeeCode"), new DataColumn("FirstName"), new DataColumn("LastName"), new DataColumn("Department"), new DataColumn("Designation"), new DataColumn("BloodGroup") }); ViewState["Employees"] = dt; this.BindEmployeeGrid(); } } protected void BindEmployeeGrid() { try { grdEmployees.DataSource = (DataTable)ViewState["Employees"]; grdEmployees.DataBind(); } catch (Exception ex) { throw ex; } } protected void InsertRow() { try { DataTable dt = (DataTable)ViewState["Employees"]; dt.Rows.Add(txtCompany.Text.Trim(), txtEmployeeCode.Text.Trim(), txtFirstName.Text.Trim(), txtLastName.Text.Trim(), txtDepartment.Text.Trim(), txtDesignation.Text.Trim(), txtBloodgroup.Text.Trim()); ViewState["Employees"] = dt; this.BindEmployeeGrid(); ClearFields(); } catch (Exception ex) { throw; } } protected void ClearFields() { try { txtCompany.Text = string.Empty; txtEmployeeCode.Text = string.Empty; txtFirstName.Text = string.Empty; txtLastName.Text = string.Empty; txtDepartment.Text = string.Empty; txtDesignation.Text = string.Empty; txtBloodgroup.Text = string.Empty; } catch (Exception ex) { throw ex; } } protected void btnInsert_Click(object sender, EventArgs e) { try { InsertRow(); } catch (Exception ex) { throw ex; } } }
Codingvila provides articles and blogs on web and software development for beginners as well as free Academic projects for final year students in Asp.Net, MVC, C#, Vb.Net, SQL Server, Angular Js, Android, PHP, Java, Python, Desktop Software Application and etc.
Thank you for your valuable time, to read this article, If you like this article, please share this article and post your valuable comments.
Once, you post your comment, we will review your posted comment and publish it. It may take a time around 24 business working hours.
Sometimes I not able to give detailed level explanation for your questions or comments, if you want detailed explanation, your can mansion your contact email id along with your question or you can do select given checkbox "Notify me" the time of write comment. So we can drop mail to you.
If you have any questions regarding this article/blog you can contact us on info.codingvila@gmail.com
Tutup Konverter!sentiment_satisfied Emoticon