Im trying to sort a column in order (1 to ...) within sql using asp.net and c#. After doing some research it seems like I need to change my column type in SQL Server to int however this is not possible as the column is storing house numbers and I could end up with a house number of 10a (for example) so currently is set to varchar. Because of this it doesnt correctly sort the column. I have tried casting the relevant column as an int but then when running the application I get an error for its bind in gridview, I've also tried other this as the \* 1 but still get errors on the bind part when running

SQL Statement

```
    SELECT DISTINCT tblcontact.ContactID, tblcontact.Forename, tblcontact.Surname, 
    tbladdress.[House Number], tbladdress.AddressLine1, tbladdress.AddressLine2, 
    tblcontact.[Business Name] FROM tblcontact INNER JOIN tbladdress ON tblcontact.AddressID = tbladdress.AddressID 
    LEFT OUTER JOIN tblDonate 
    ON tblcontact.ContactID = tblDonate.ContactID 
    WHERE (tbladdress.CollectionArea = @CollectionArea) AND 
(tbladdress.AddressLine1 = @drpCollectionStreet) 
    ORDER BY tbladdress.[House Number] ASC

```

Gridview Markup

```
                                    <asp:TemplateField HeaderText="House Number">
                                        <EditItemTemplate>
                                            <asp:TextBox ID="txtHouseNum" runat="server" Text='<%# Bind("[House Number]") %>'></asp:TextBox>
                                        </EditItemTemplate>
                                        <ItemTemplate>
                                            <asp:Label ID="lblHouseNum" runat="server" Text='<%# Bind("[House Number]") %>'></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>

```

Here's an example of how its sorting

```
21
22
27
28
5
6
8
9

```

This is how I cast as int which sorts fine within SQL but I get an error on the Bind (above)

```
SELECT DISTINCT tblcontact.ContactID, tblcontact.Forename, tblcontact.Surname, cast(tbladdress.[House Number] as int), 
tbladdress.AddressLine1, tbladdress.AddressLine2, tblcontact.[Business Name] 
FROM tblcontact INNER JOIN tbladdress ON tblcontact.AddressID = tbladdress.AddressID 
LEFT OUTER JOIN tblDonate ON tblcontact.ContactID = tblDonate.ContactID 
WHERE (tbladdress.CollectionArea = 'Queens Park') AND (tbladdress.AddressLine1 = 'Kings Road') 
ORDER BY cast(tbladdress.[House Number] as int)

```

Error in runtime

this is the error when running (this is the most meaningful)

```
 "House Number is neither a DataColumn nor a DataRelation for table DefaultView."} 

```