You can set the default sorting for the grid by setting default column and sort expression as below in page load event.
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { gridViewName.Sort("Name", SortDirection.Ascending); } }
This blog gives latest information ...about asp.net,C#.net,SQL server,Java scripts.... and many more technologies...
You can set the default sorting for the grid by setting default column and sort expression as below in page load event.
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { gridViewName.Sort("Name", SortDirection.Ascending); } }
| Employee Table | |
| LastName | DepartmentID |
| Rafferty | 31 |
| Jones | 33 |
| Steinberg | 33 |
| Robinson | 34 |
| Smith | 34 |
| Jasper | NULL |
| Department Table | |
| DepartmentID | DepartmentName |
| 31 | Sales |
| 33 | Engineering |
| 34 | Clerical |
| 35 | Marketing |
ORIGINAL ONE:
SELECT Employee.lastName, Employee.DepartmentID, Department.DepartmentName
FROM Employee INNER JOIN Department
ON Employee.DepartmentID = Department.DepartmentID;
ALTERNATIVE ONE:
SELECT Employee.lastName, DepartmentID, Department.DepartmentName
FROM Employee INNER JOIN Department
USING(DepartmentID);
Happy Coding :)
<asp:BoundField DataField="MyDate" DataFormatString="{0:d}" HeaderText="DaDate" />
| Format Pattern | Name | Example |
|---|---|---|
d | Short date format | 8/27/1989 |
D | Long date format | Sunday, August 27, 1989 |
t | Short time format | 3:32 PM |
T | Long time format | 3:32:00 PM |
f | Full date/time format (short time) | Sunday, August 27, 1989 3:32 PM |
f | Full date/time format (long time) | Sunday, August 27, 1989 3:32:00 PM |
g | General date/time format (short time) | 8/27/1989 3:32 PM |
G | General date/time format (long time) | 8/27/1989 3:32:00 PM |
m or M | Month day format | August 27 |
r or R | RFC 1123 format | Sun, 27 Aug 1989 8:32:00 GMT |
s | Sortable date/time format | 1989-08-27T15:32:00 |
u | Universable sortable date/time format | 1989-08-27 15:32:00z |
U | Universable sortable date/time format | Sunday, August 27, 1989 11:32:00 PM |
y or Y | Year month format | August, 1989 |