CraiovaBesT
New Member
I have a sub that retrieves record and displays it. The parameter is passed using a regular form field. My question is how can I display "No Records Found" message when there are no records returned? <BR><BR>Here is my sub...<BR><BR>Sub Page_Load(Sender As Object, E As EventArgs)<BR><BR> Dim ConnectionString As String = "server=local;database=Test;trusted_connection=true"<BR><BR> application<BR> Dim CommandText As String = "sp_customers"<BR><BR> Dim myConnection As New SqlConnection(ConnectionString)<BR> Dim myCommand As New SqlCommand(CommandText, myConnection)<BR> Dim workParam As New SqlParameter()<BR><BR> myCommand.CommandType = CommandType.StoredProcedure<BR><BR> myCommand.Parameters.Add("@customerID", SqlDbType.Int).Value = http://aspmessageboard.com/archive/index.php/Request.Form("T1")<BR> <BR> myConnection.Open()<BR><BR> DataGrid1.DataSource = myCommand.ExecuteReader(CommandBehavior.CloseConne ction)<BR> DataGrid1.DataBind()<BR><BR>End Sub<BR>I would set up 2 panels, and put the datagrid in one and a label control in another. Then, before you databind, check if there are any records. If there are none, hide the datagrid and make the label visible with text of "No records found" or whatever. If there ARE records, make the label not visible, show the datagrid, and then Databind.And how would I go about doing this? Remember I am a newbie 
