문제

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.

Does this make sense? What may be the best way for me to go about 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.

도움이 되었습니까?

해결책

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

다른 팁

You could also use the Wizard control, ask the Questions in Step 1 and return the response in Step 2. That is just an alternative, but the above is really the way to go.

In your Submit button code, after your VBScript runs you can just set the visibility of the Asp.net controls to false.

Something like this.

Private Sub btnSubmit_Click(sender As Object, e As EventArgs)

    ... 

    btnSubmit.visible = false
    gridview1.visible = true

End Sub

Also on the .aspx page set these control to there default state so the submit button when the user first gets to the page should by visible, and the gridview to be not visible.

Hope this helps.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top