Posts

Showing posts from May, 2011

Using button columns in gridview

Hello Guys.! i have faced a many problem with gridview when i was fresher nd want to learn about the gridview nd faced the problem in attached the different types of buttons. today m thinking abt that problem....so we'll make a program in which we'll add a different types of buttons... m sure it'll be a very interesting program....

Export to Excel Sheet

Image
Hello Guys.\ ! Today we'll make a program that how to convert GridView data in Excel Sheet.. so......... just you have to make a GridView from your Toolbox along with a button.. nd just make it very easy code.  protected void Page_Load(object sender, EventArgs e)     {         if (!Page.IsPostBack)         {             BindData();         }     } //just make a connection with your database which table you want to use in your program.....     private void BindData()     {         string constr = @"Server=kishu-pc;Database=NORTHWIND;uid=sa; Password=pass@word1;";         string query = "SELECT ProductID, ProductName, UnitPrice FROM Products";         SqlDataAdapter da = new SqlDataAdapter(query, constr);         DataTable table = new DataTable();         da.Fill(table);         GridView1.DataSource = table;         GridView1.DataBind();     }       public override void VerifyRenderingInServerForm(Control control) { // its simply

Formatting GridView

Image
Today i have just making a intersting thing. i made the funny view of gridview. let's start for making it ! first you have to select a grid view control from your toolbox. yup one more thing just download a northwind database. it'll be a very helpfull to you for doing any practice......  <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" BackColor="YellowGreen"             BorderColor="#336699" BorderStyle="Solid" BorderWidth="1px" CellPadding="2"             Font-Names="Verdana" Font-Size="10pt" Width="60%" DataKeyNames="ProductID"             GridLines="Horizontal">      <Columns>       <asp:BoundField DataField="ProductID" HeaderText="ProductID" />       <asp:BoundField DataField="ProductName" HeaderText="ProductName" />