Home » .NET 4.0 » VB.NET – passing string value from code behind to markup on the page

VB.NET – passing string value from code behind to markup on the page

Solution 1

Protected doit As String = "Hello" (in .vb file)

< %=Me.doit%> (inside the markup)

Solution 2

'automatic properties
Protected Property doit2 As String = "Hello" (in .vb file)

< %=doit2%> (inside the markup)

'no automatic properties Private _doit3 As String (in .vb file) Protected Property doit3 As String Get Return _doit3 End Get Set(value As String) _doit3 = value End Set End Property < %=doit3%> (inside the markup)
Solution 3

Public doit4 As String = "Hello" (in .vb file)

< %=doit4%> (inside the markup)