Search code examples
asp.netdatabasevb.net

Need to hide a section of my ASP.NET webpage until the user clicks submit


I have a page in ASP.NET written in VB.NET. It is a series of checklists that the user will click on. When they click "SUBMIT" VBScripts will run in the background and post to a database.

I need to then get results from the database in a table.

I think I will use either GridView or ListView to do this. A requirement is when the user hits submit, the table will appear on the same page and the preexisting "SUBMIT" button will disappear.

How could I implement something like this?

Currently I do not have the DB implemented but that is something I am planning to have in a week. I do have a "test" DB I can utilize.


Solution

  • Could you simply set the visibility of the button to false and the gridview to true during postback?

    e.g.

    If(Not IsPostBack) Then
    {
        submitButton.Visible = true; // show button
        gridView.Visible = false;    // hide grid
    }
    Else
    {
        submitButton.Visible = false;  // user submitted, so hide button
        gridView.Visible = true;       // show grid
    }
    EndIf