How do I programmatically assign a value to the Text property in Label control
Posted on 2004-11-30
I am having difficulty assigning a value to the text property in a label control. The ultimate aim of the page is to pass a value along a query string which will access a SQL Server database and return a page of results using this value as a parameter.
Page 1 contains a datagrid with three bound columns which display a staff number, surname and forename, and one template column in which I've placed a button which will open a new window, passing the staff code along the query string to Page 2
I'm quite new to ASP.NET so started by playing with Page 2 to see how a label picks up a Text value. I assigned a simple value to the Text property of the label:
file staff_edit.aspx contains the following:
<p>Staff Code: <asp:label id="Code" runat="server"></asp:label></p>
The code behind this is:
Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Code.Text = "insert staff code here"
This is textbook, but doesn't appear to work in my application - what am I doing wrong!!!!
We are also using the Data Application Block for .NET
Any help greatly appreciated :)