Click here to Skip to main content
15,887,485 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
GeneralRe: Looping for Datatable Pin
PIEBALDconsult5-Apr-15 16:08
mvePIEBALDconsult5-Apr-15 16:08 
QuestionDeveloping Client/Server Stock Control/Inventory Management (WCF) Pin
ndswdev2-Apr-15 5:24
ndswdev2-Apr-15 5:24 
AnswerRe: Developing Client/Server Stock Control/Inventory Management (WCF) Pin
Richard MacCutchan2-Apr-15 21:14
mveRichard MacCutchan2-Apr-15 21:14 
AnswerRe: Developing Client/Server Stock Control/Inventory Management (WCF) Pin
jschell3-Apr-15 8:51
jschell3-Apr-15 8:51 
AnswerRe: Developing Client/Server Stock Control/Inventory Management (WCF) Pin
Dominic Burford15-Apr-15 20:27
professionalDominic Burford15-Apr-15 20:27 
QuestionVB.NET CRYSTAL REPORT Pin
Pauls Pauls2-Apr-15 2:47
Pauls Pauls2-Apr-15 2:47 
AnswerRe: VB.NET CRYSTAL REPORT Pin
ZurdoDev3-Apr-15 10:26
professionalZurdoDev3-Apr-15 10:26 
Questionerror with setting value to label from Page_Load sub Pin
spirospap1-Apr-15 15:02
spirospap1-Apr-15 15:02 
Quote:
In a code behind page under the Page_Load sub, I am trying to set some value to a Label:

Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
myLabel.Text = "Some text"
End Sub

I keep getting 'myLabel' is not declared. It may be inaccessible due to its protection level.

But I do have the following :

<asp:label id="myLabel" runat="server" text="text" visible="true">

This control (along with other controls) is inside the following tag:
<asp:formview id="FormView1" runat="server" datasourceid="sqlDS_ProjectForm" defaultmode="Edit" width="900px">

.
.

I have tried something similar in a separate simple project, where I can display the required text in the label, as a result of the Page_Load

Partial Class _Default
Inherits System.Web.UI.Page

Hide Copy Code
Private Sub Form1_Load(ByVal sender As System.Object, ByVal _
e As System.EventArgs) Handles MyBase.Load
Label1.Text = "some text";
End Sub

End Class


UPDATE
So I have worked out that the behind the code page needed a FindControl method to find the actual Label control
Now I have to assign a value to it.

FINAL UPDATE (and solution)
After some research I managed to find what I was looking for, yes I am a noob, we all were at some time

Dim SpirosLabel As Label = DirectCast(FormView1.FindControl("myLabel"), Label)
SpirosLabel.Text = HttpContext.Current.User.Identity.Name

modified 1-Apr-15 22:27pm.

AnswerRe: error with setting value to label from Page_Load sub Pin
ZurdoDev3-Apr-15 10:28
professionalZurdoDev3-Apr-15 10:28 
Questionsetup installing also net Framework Pin
Member 1124932730-Mar-15 23:25
Member 1124932730-Mar-15 23:25 
AnswerRe: setup installing also net Framework Pin
Eddy Vluggen31-Mar-15 7:24
professionalEddy Vluggen31-Mar-15 7:24 
QuestionTabControl with Tabs of tabpages on both sides in a windows form Pin
fabsyl30-Mar-15 20:26
fabsyl30-Mar-15 20:26 
AnswerRe: TabControl with Tabs of tabpages on both sides in a windows form Pin
Eddy Vluggen31-Mar-15 7:20
professionalEddy Vluggen31-Mar-15 7:20 
GeneralRe: TabControl with Tabs of tabpages on both sides in a windows form Pin
fabsyl31-Mar-15 20:29
fabsyl31-Mar-15 20:29 
GeneralRe: TabControl with Tabs of tabpages on both sides in a windows form Pin
fabsyl31-Mar-15 22:26
fabsyl31-Mar-15 22:26 
GeneralRe: TabControl with Tabs of tabpages on both sides in a windows form Pin
Eddy Vluggen31-Mar-15 23:46
professionalEddy Vluggen31-Mar-15 23:46 
AnswerRe: TabControl with Tabs of tabpages on both sides in a windows form Pin
Gerry Schmitz1-Apr-15 0:17
mveGerry Schmitz1-Apr-15 0:17 
QuestionRe-Full Text Search Pin
Member 1116162530-Mar-15 1:55
Member 1116162530-Mar-15 1:55 
AnswerRe: Re-Full Text Search Pin
Richard MacCutchan30-Mar-15 2:34
mveRichard MacCutchan30-Mar-15 2:34 
AnswerRe: Re-Full Text Search Pin
Eddy Vluggen30-Mar-15 3:10
professionalEddy Vluggen30-Mar-15 3:10 
AnswerRe: Re-Full Text Search Pin
ZurdoDev30-Mar-15 4:45
professionalZurdoDev30-Mar-15 4:45 
QuestionRe-Index Pin
Member 1116162530-Mar-15 1:50
Member 1116162530-Mar-15 1:50 
AnswerRe: Re-Index Pin
ZurdoDev30-Mar-15 4:44
professionalZurdoDev30-Mar-15 4:44 
Questioni have just in time debugging problem Pin
rafizan4629-Mar-15 23:01
rafizan4629-Mar-15 23:01 
QuestionRe: i have just in time debugging problem Pin
Richard MacCutchan29-Mar-15 23:10
mveRichard MacCutchan29-Mar-15 23:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.