Hi everyone,
I'm trying to create a GridView with the following criteria:
1. I need to have 5 fields of personal info of every employee (DB TABLE : Usernames - FIELDS: name, username, e-mail, contract, isIT)
2. I need 2 fields which are the start month and year of each employee (DB TABLE: Employment - FIELDS: month, year)
3. I need 2 fields which are the last month and year of each employee (DB TABLE: Employment - FIELDS: month, year)
Every row (which represents info about each employee) of the GridView should be consisted of all the above fields.
So far I succeeded to have no.1 working in the following way:
QueryCommand smd = new QueryCommand(sql);
ds = DataService.GetDataSet(smd);
GridView1.DataSource = ds;
GridView1.DataBind();
It's quite hard for me to create such a complicated query which will give me all the above together (1, 2 and 3).
(If somebody is comfortable with SQL maybe he/she can help me out).
If not, is there a way to append more columns in my already existing GridView using another sql statement?
Can you think of any other ways?
My GridView is sortable:
protected void GridView1_Sorting(object sender, GridViewSortEventArgs e)
{
String SOS = Session["mySql"].ToString();
string sortExpression = (string)Session["SortExp"];
string sortDirection = (string)Session["SortDir"];
if (sortExpression != e.SortExpression)
{
sortExpression = e.SortExpression;
sortDirection = "asc";
}
else
{
if (sortDirection == "asc")
sortDirection = "desc";
else
sortDirection = "asc";
}
Session["SortExp"] = sortExpression; Session["SortDir"] = sortDirection;
QueryCommand smd = new QueryCommand(SOS);
ds = DataService.GetDataSet(smd);
DataView dv = new DataView(ds.Tables[0]);
dv.Sort = sortExpression + " " + sortDirection;
GridView1.DataSource = dv;
GridView1.DataBind();
}
Will it still be sortable if I add more columns in it?
Thank you!
I'm trying to create a GridView with the following criteria:
1. I need to have 5 fields of personal info of every employee (DB TABLE : Usernames - FIELDS: name, username, e-mail, contract, isIT)
2. I need 2 fields which are the start month and year of each employee (DB TABLE: Employment - FIELDS: month, year)
3. I need 2 fields which are the last month and year of each employee (DB TABLE: Employment - FIELDS: month, year)
Every row (which represents info about each employee) of the GridView should be consisted of all the above fields.
So far I succeeded to have no.1 working in the following way:
QueryCommand smd = new QueryCommand(sql);
ds = DataService.GetDataSet(smd);
GridView1.DataSource = ds;
GridView1.DataBind();
It's quite hard for me to create such a complicated query which will give me all the above together (1, 2 and 3).
(If somebody is comfortable with SQL maybe he/she can help me out).
If not, is there a way to append more columns in my already existing GridView using another sql statement?
Can you think of any other ways?
My GridView is sortable:
protected void GridView1_Sorting(object sender, GridViewSortEventArgs e)
{
String SOS = Session["mySql"].ToString();
string sortExpression = (string)Session["SortExp"];
string sortDirection = (string)Session["SortDir"];
if (sortExpression != e.SortExpression)
{
sortExpression = e.SortExpression;
sortDirection = "asc";
}
else
{
if (sortDirection == "asc")
sortDirection = "desc";
else
sortDirection = "asc";
}
Session["SortExp"] = sortExpression; Session["SortDir"] = sortDirection;
QueryCommand smd = new QueryCommand(SOS);
ds = DataService.GetDataSet(smd);
DataView dv = new DataView(ds.Tables[0]);
dv.Sort = sortExpression + " " + sortDirection;
GridView1.DataSource = dv;
GridView1.DataBind();
}
Will it still be sortable if I add more columns in it?
Thank you!