I need to display SSN as one datacolumn in Gridview. My data is in 3 different table fields. As I found, there is no way to combine data using BoundField.
Therefore, I use SQL statement to concatenate 3 fields together. Here is a statement:
SELECT studentid, fname, mi, lname, dob, (ss1 + '-' + ss2 + '-' + ss3) as ssn FROM students order by studentid asc
Now I can easily display SSN in GridView:
<asp:BoundField DataField="ssn" HeaderText="SSN#" SortExpression="ssn" />
Therefore, I use SQL statement to concatenate 3 fields together. Here is a statement:
SELECT studentid, fname, mi, lname, dob, (ss1 + '-' + ss2 + '-' + ss3) as ssn FROM students order by studentid asc
Now I can easily display SSN in GridView:
<asp:BoundField DataField="ssn" HeaderText="SSN#" SortExpression="ssn" />
No comments:
Post a Comment