<asp:GridView ID="grdData" runat="server" align="center" AutoGenerateColumns="False" class="tabulardata" HorizontalAlign="Center" Width="50%" OnRowCancelingEdit="grdData_RowCancelingEdit" OnRowDataBound="grdData_RowDataBound" OnRowEditing="grdData_RowEditing" OnRowUpdating="grdData_RowUpdating" OnRowCommand="grdData_RowCommand" ShowFooter="True" AllowPaging="true" OnRowUpdated="grdData_RowUpdated"> <columns> <asp:TemplateField HeaderText="Sl.No" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="4%"> <itemtemplate> <asp:Label ID="Sno" runat="server"> </itemtemplate> <itemstyle horizontalalign="Center" /> <asp:BoundField HeaderText="Emp Number" Visible="true" DataField="EmpNo" ItemStyle-HorizontalAlign="center" ReadOnly="true" SortExpression="EmpNo"> <itemstyle horizontalalign="Center" width="20%" /> <asp:BoundField HeaderText="EmpName" Visible="true" DataField="EmpName" ItemStyle-HorizontalAlign="center" ReadOnly="true" SortExpression="EmpName"> <itemstyle horizontalalign="Center" width="20%" /> </columns> <alternatingrowstyle backcolor="#EAEAFF" /> <emptydatarowstyle backcolor="LightBlue" forecolor="Red" /> <emptydatatemplate> <asp:image id="NoDataImage" imageurl="~/Images/Edit.png" alternatetext="No Image" runat="server"/> No Data Found. </emptydatatemplate>
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Not IsPostBack Then FillGridValues() End If End Sub Public Sub FillGrid_BIDDataValues() Conn.Open() Qry = "" Qry = "select * from EmpTab" SQLDA = New SqlDataAdapter(Qry, Conn) dttable = New DataTable SQLDA.Fill(dttable) If dttable.Rows.Count > 0 Then grdData.DataSource = dttable grdData.DataBind() End If Conn.Close() End Sub
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)