i have gridview like this
name mobilenumber area
raju 9849111111 hyd
vamshi 9996622456 hyd
sata 9966643476 hyd
vbn 9849111111 hyd
sdf 9996622456 hyd
qwer 900004444 viz
yui 9996622456 viz
i wan ouput like this ......
name mobilenumber area
raju 9849111111 hyd
vbn 9849111111 hyd
vamshi 9996622456 hyd
sdf 9996622456 hyd
yui 9996622456 viz
sata 9966643476 hyd
qwer 900004444 viz
same mobile numers display serial....
plz write the code
Loading
Satyapriya NayakPosted Mar 10, 2013, 7:03 AM
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
namespace Gridview
{
public partial class WebForm2 : System.Web.UI.Page
{
string connStr = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
SqlCommand com;
SqlDataAdapter sqlda;
DataSet ds;
string str;
protected void Page_Load(object sender, EventArgs e)
{
bindgrid();
}
private void bindgrid()
{
SqlConnection con = new SqlConnection(connStr);
con.Open();
str = "select * from emp ORDER BY mobilenumber desc";
com = new SqlCommand(str, con);
sqlda = new SqlDataAdapter(com);
ds = new DataSet();
sqlda.Fill(ds, "emp");
GridView1.DataMember = "emp";
GridView1.DataSource = ds;
GridView1.DataBind();
con.Close();
}
}
}