I have a code behind aspx.vb that have a variable.
And I want to use it on the .aspx web page.
eg.
Public Class proventos_rendimento_distribuicoes_amortizacoes
Inherits System.Web.UI.Page
Dim id_to_use As String = ""
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Me.IsPostBack Then
lblCustomerId.Text = Me.Page.RouteData.Values("nome_artigo").ToString()
id_to_use = Me.Page.RouteData.Values("nome_artigo").ToString()
End If
End Sub
End Class
And I want to use it on .aspx with something like <%= id_to_use %>
eg
<b>Customer Id:</b>
<asp:Label ID="lblCustomerId" runat="server" />
<br />
<b><%= id_to_use %></b>
But this doesn't work.
Is it possible to do it?
Just need to declare Dim id_to_use As String = "" to public:
public Dim id_to_use As String = ""
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Me.IsPostBack Then
lblCustomerId.Text = Me.Page.RouteData.Values("nome_artigo").ToString()
id_to_use = Me.Page.RouteData.Values("nome_artigo").ToString()
End If
End Sub
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.