What I'm trying to do is quite simple, I think. I just don't know how to go about it.
I'm hitting my SQL server database and retrieving only about 5-6 columns. The most amount of rows I'm going to have is MAYBE 20-30 tops.
Here's what I have so far. Just the connection, retrieve my data, bind it, and close the connection.
This throws my data into the gridview just fine. However, what I'd like to do is be able to go to through each of these rows and evaluate them, and determine how to add them to the gridview.
Example: I'd like all of MY incidents to be at the top. Ownership comes from the currentOwner column from the table. Current owner will also be grabbed in the browser as the users current windows NT id. So for each row, I'd like to see if currentOwner == myNTid. if it is, add it to the gridview, and change the background color of it. Once all of mine have been added, then I'd like to add those that have currentOwner == NULL, color them, then add the rest of them beneath that.
Thanks!
I'm hitting my SQL server database and retrieving only about 5-6 columns. The most amount of rows I'm going to have is MAYBE 20-30 tops.
Here's what I have so far. Just the connection, retrieve my data, bind it, and close the connection.
Code:
SqlConnection SQL_details = new SqlConnection(ConfigurationManager.ConnectionStrings["conStr1"].ConnectionString);
try
{
SQL_details.Open();
}
catch (Exception e)
{
//do something here?
}
SqlDataAdapter cmd_gv = new SqlDataAdapter("SELECT incID, priorityLevel, CONVERT(VARCHAR(8), openDate, 1) AS open_Date, locationNum, descr FROM incDetails", SQL_details);
DataSet ds = new DataSet();
cmd_gv.Fill(ds, "gv");
gvMyinc.DataSource = ds.Tables["gv"].DefaultView;
gvMyinc.DataBind();
try
{
SQL_details.Close();
}
catch (Exception e)
{
//do something here?
}
This throws my data into the gridview just fine. However, what I'd like to do is be able to go to through each of these rows and evaluate them, and determine how to add them to the gridview.
Example: I'd like all of MY incidents to be at the top. Ownership comes from the currentOwner column from the table. Current owner will also be grabbed in the browser as the users current windows NT id. So for each row, I'd like to see if currentOwner == myNTid. if it is, add it to the gridview, and change the background color of it. Once all of mine have been added, then I'd like to add those that have currentOwner == NULL, color them, then add the rest of them beneath that.
Thanks!