Put a Label next to Datalist
<asp:Label ID="lblMessage" runat="server" Text="No records found"></asp:Label>
and then in code do as following
SqlCommand _cmd = new SqlCommand("showoffer", _cn);
_cmd.CommandType = CommandType.StoredProcedure;
_cmd.Parameters.AddWithValue("@Model", code);
_cn.Open();
SqlDataReader _dr = _cmd.ExecuteReader();
if (_dr.HasRows)
{
DataList1.DataSource = _dr;
DataList1.DataBind();
lblMessage.Visible = false;
}
else
{
DataList1.Visible = false;
lblMessage.Visible = true;
}
_cn.Close();