GridView Sorting An Ascending and Descending
GridView Display DataBase Table Values Click The GridView Header Sorting Ascending and Descending Order Display After Click.
Download Coding
Download
DEMO
C# CODING
GridView Display DataBase Table Values Click The GridView Header Sorting Ascending and Descending Order Display After Click.
Download Coding
Download
DEMO
HTML CODING
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="GridView Display" />
<table><tr><td</td><td>
<asp:GridView ID="GridView1" runat="server" AllowSorting="True" AutoGenerateColumns="False"
DataSourceID="SqlDataSource1" Visible="False">
<Columns>
<asp:BoundField DataField="id" HeaderText="ID" InsertVisible="False" ReadOnly="True"
SortExpression="id" />
<asp:BoundField DataField="name" HeaderText="NAME" SortExpression="name" />
<asp:BoundField DataField="country" HeaderText="COUNTRY" SortExpression="country" />
<asp:BoundField DataField="amount" HeaderText="AMOUNT" SortExpression="amount" />
</Columns>
<HeaderStyle BackColor="#FF66CC" />
<RowStyle BackColor="Silver" />
<AlternatingRowStyle BackColor="#CC33FF" />
</asp:GridView>
</td></tr></table>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:dbcon %>" SelectCommand="SELECT * FROM [country]">
</asp:SqlDataSource>
</div>
</form>
</body>
</html>
C# CODING
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
public partial class Default4 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
GridView1.Visible = true;
}
}
0 comments:
Post a Comment