I have a gridview
<asp:GridView ID="grdSearchResults" runat="server"
AutoGenerateColumns="False
" DataKeyNames="PropertyID"
onselectedindexchanged="gr
dSearchRes
ults_Selec
tedIndexCh
anged"
SkinID="GridViewSkin"
EmptyDataText="No properties have been returned - create new property below">
<columns>
<asp:boundfield DataField="PropertyID" Visible="False"></asp:boun
dfield>
<asp:boundfield DataField="Address1" HeaderText="Address"></asp
:boundfiel
d>
<asp:boundfield DataField="PostCode" HeaderText="Post Code"></asp:boundfield>
<asp:commandfield SelectText="Select This Property" ShowSelectButton="True">
</asp:commandfield>
</columns>
</asp:GridView>
Here is the code to populate using subsonic..........
Query qry = new Query("ClientProperty");
qry.QueryType = QueryType.Select;
if (txtAddress1.Text.Length > 1)
{
qry.AddWhere("ClientProper
ty", "Address1", Comparison.Like, txtAddress1.Text);
}
if (txtPostCode.Text.Length > 1)
{
qry.AddWhere("ClientProper
ty", "PostCode", Comparison.Like, txtPostCode.Text);
}
IDataReader myReader = qry.ExecuteReader();
grdSearchResults.DataSourc
e = myReader;
grdSearchResults.DataBind(
);
myReader.Close();
However if no results are returned the emptydatatemplate does not display
Start Free Trial