IsPostBack asp.net

1

My asp.net application (aspx) has two Label controls that need to be populated with information from a Request QueryString. In Page_Load I make the treatment so that Label-type controls receive this information and actually receive it, but it does not render, that is, it does not appear on the page. I made a test by placing constants in place of the Request QueryString values and when I do this the Label type controls are populated. What could this be? I have read a lot about ViewState and its commands but none have resolved.

insira o código aqui
<asp:Panel ID="panFeedBack" runat="server">
    <div class="row">
        <div class="col-xs-8">
            <div class="control-group">
                <div class="controls">
                    <asp:Label ID="lblMarcacao" runat="server"></asp:Label>
                </div>
            </div>
        </div>
    </div>
</asp:Panel>


insira o código aqui
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    If Not Request.QueryString.Item("id") Is Nothing Then
        Dim QueryStrMarcacao As String = Request.QueryString.Item("id").Split("|")(1)
        lblMarcacao.Text = "Marcação: " & QueryStrMarcacao
    End If
End Sub
    
asked by anonymous 25.08.2017 / 03:30

1 answer

0

Try the code:

If Not Request.QueryString("id") Is Nothing Then
     Dim QueryStrMarcacao As String = Request.QueryString("id")
     lblMarcacao.Text = "Marcação: " & QueryStrMarcacao
End If

Follow Images: VB Code: link

ASP code: link

Page: link

As for the viewstate, it is the way ".net" identifies the page status, for example the "IsPostBack" used in Page_load, it identifies if it is the first time it is accessing the page, therefore it is not a postBack Reload of the page), however if you used some item in the page that generates postBack, example a droDownList that loads another, the page will generate a postBack and through this identification you will be able to maintain the state of the items in the page

    
25.08.2017 / 03:55