ASP.NET Label Inside UpdatePanel not updating

I am new to ASP.NET and I am trying to get a shortcut for the update with some information that is captured when I click the button. The click function is called and returns only a penalty (I debugged and went through all this). The only thing that doesn't work is to set the text of the shortcuts I'm trying to update.

This is a function called by pressing a button:

Protected Sub submitbutton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles submitbutton.Click Dim res As String() = query(email1.Text) If Not res Is Nothing Then url1.Text = res(0) date1.Text = res(1) End If End Sub 

I know that it goes into if and tries to set the text, but nothing happens on the client side.

This is UpdatePanel for me:

 <asp:UpdatePanel ID="UpdatePanelSettings" runat="server" UpdateMode="Always" > <Triggers> <asp:AsyncPostBackTrigger ControlID="submitbutton" EventName="click" /> </Triggers> <ContentTemplate> <table> <tr> <td>Emails</td><td>Url Parsed</td><td>Date Created</td> </tr> <tr> <td> <asp:TextBox runat="server" ID="email1" Width="300" /> </td> <td> <asp:Label runat="server" ID="url1" Text="-" /> </td> <td> <asp:Label runat="server" ID="date1" Text="-" /> </td> </tr> <tr> <td colspan="3"><asp:Button ID="submitbutton" runat="server" Text="Submit" /></td> </tr> </table> </ContentTemplate> </asp:UpdatePanel> 

As I said, I know that the trigger works because I went through the code when it was called. I know that you also need the ScriptManager, which I have right inside the form element that goes into the Site.Master file (I just got stuck in the default template, this is just a proof of conceptual design).

 <form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server" /> 

Of all the articles I found on the Internet, this should be all I need. One article mentioned that you need to do something with Web.Config, but she said that for VS 2005 and I use 2010. He mentioned that you do not need to change anything in 2008, so I decided that the same is true for 2010. What am I missing, what do I need for the tags to be updated?

+6
source share
3 answers

I have not worked with this for a while, but you may need to explicitly call:

 UpdatePanelSettings.Update() 

At the end of your team.

.

Give it a try anyway.

+1
source

You can try to delete the section.

 <Triggers> <asp:AsyncPostBackTrigger ControlID="submitbutton" EventName="click" /> </Triggers> 

Then change the UpdatePanel to add ChildAsTriggers = "true" to it.

 <asp:UpdatePanel ID="UpdatePanelSettings" runat="server" UpdateMode="Always" ChildrenAsTriggers="true" > 

In theory, this should be exactly the same as you, but just trying to help you debug it.

+3
source

1) Is it possible that res are two empty elements?

2) Is there any other code that relates to two labels (for example, when the form loads)?

+1
source

Source: https://habr.com/ru/post/897966/


All Articles