Posts

Showing posts from January, 2014

How to add a static row to a gridview

  add a static row to a gridview with c#. Here I  explain how to add a static row to a gridview with c# protected void grd_Pre(object sender, EventArgs e) {     GridViewRow gv = new GridViewRow(0, 0, DataControlRowType.Header,    DataControlRowState.Normal);     TableCell TC = new TableCell();     TC.ColumnSpan = 3;     TC.Text = "Gridview head";er     TC.Attributes.Add("style", "text-align:right");     gv.Cells.Add(tc);     this.GridView1.Controls[0].Controls.AddAt(0, gv); }

show gridview header.

asp.net show  gridview header when no data or no recoards  in gridview.  Here I explain how to display or show gridview header even if gridview does not contain data or show gridview header with no records or data. aspx page- <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="Admin_Exam_Default" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server">     <title></title>     <style type="text/css">         .Gridview         {}     </style> </head> <body>     <form id="form1" runat="server">     <div>     <asp:GridView ID="gvdata" runat="server" CssClass="Gridview" GridLines="Both...