I have a webform that contains a gridview and textbox (written in
Visual Studio 2008 - VB).  Pretty standard...user inputs search
criteria in the textbox, user hits submit button (or ENTER), the
results are displayed in the gridview.  I am trying to implement the
following logic if the gridview results are null:

If GridView1.Rows.Count > 0 Then
            Me.Label1.Visible = False
        Else
            Me.Label1.Visible = True
            Me.Label1.Text = "No results match your request."
        End If

        Me.GridView1.Visible = True

This works fine, HOWEVER, it requires me to push the submit button
twice to update either way.

Scenario 1:
SEARCH CRITERIA:  "Invalid Search Value"
RESULTS:  null
DISPLAY (Click 1): Nothing
DISPLAY (Click 2): Message Displayed: No results match your request.

If I then input good search criteria right after that...

Scenario 2:
SEARCH CRITERIA:  "Valid Search Value"
RESULTS:  Valid Results
DISPLAY (Click 1): Gridview with results AND message still shows up.
DISPLAY (Click 2): Gridview with results

Is there anyway to activate this with only one click?

Any help would be greatly appreciated.

Thank you!

Brad

Reply via email to