473,467 Members | 1,565 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

reading a label from an user control

Hello,

It looks like my previous post was deleted. So here is again:

I have this user control called "encabezado" (I cut the code to make it
shorter):

public partial class Encabezado : System.Web.UI.UserControl {
private String n;
private String esta;

public Encabezado()
{
//
// TODO: Add constructor logic here
//
}
public String estado
{
get { return esta; }
set { esta = value; }
}
public String numero
{
get { return n; }
set { n = value; }
}
private void page_load()
{
mostrar_encabezado(n);
}
private void mostrar_encabezado(String numero)
{

//here I have a SQL query and later:

lbl_nro.Text = Request.QueryString["reclamo"].ToString();
lbl_estado.Text = dt.Rows[0]["estado_rec"].ToString();
lbl_icono_asig.Text = "";

esta = lbl_estado.Text;

// and these labels I use to display a table.

}
}

I use my user control on a file called "mostrar.aspx" as folows:

<hparis:encabezado ID="encabezado1" runat="server" />

On the codefile:
encabezado1.numero = Request.QueryString["reclamo"];
An it works. All the labels are printed correctly according to the
number on the QueryString["reclamo"].

When I try to use Response.Write(encabezado1.estado) in the file
"mostrar.aspx", it returns an empty String; but when I use

Response.Write(encabezado1.numero) it returns the correct number.

Why can't I use encabezado1.estado ? What I'm doing wrong ?

greetings,

hans

Jan 11 '07 #1
1 1393
Hi Hans, I thought it unlikely that your post was deleted, so found it
for you..

http://groups.google.com/group/micro...285e6e8b7df4b6

You have one reply to date!

hth,

Gary.

Hans wrote:
Hello,

It looks like my previous post was deleted. So here is again:

I have this user control called "encabezado" (I cut the code to make it
shorter):

public partial class Encabezado : System.Web.UI.UserControl {
private String n;
private String esta;

public Encabezado()
{
//
// TODO: Add constructor logic here
//
}
public String estado
{
get { return esta; }
set { esta = value; }
}
public String numero
{
get { return n; }
set { n = value; }
}
private void page_load()
{
mostrar_encabezado(n);
}
private void mostrar_encabezado(String numero)
{

//here I have a SQL query and later:

lbl_nro.Text = Request.QueryString["reclamo"].ToString();
lbl_estado.Text = dt.Rows[0]["estado_rec"].ToString();
lbl_icono_asig.Text = "";

esta = lbl_estado.Text;

// and these labels I use to display a table.

}
}

I use my user control on a file called "mostrar.aspx" as folows:

<hparis:encabezado ID="encabezado1" runat="server" />

On the codefile:
encabezado1.numero = Request.QueryString["reclamo"];
An it works. All the labels are printed correctly according to the
number on the QueryString["reclamo"].

When I try to use Response.Write(encabezado1.estado) in the file
"mostrar.aspx", it returns an empty String; but when I use

Response.Write(encabezado1.numero) it returns the correct number.

Why can't I use encabezado1.estado ? What I'm doing wrong ?

greetings,

hans
Jan 11 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Mateo | last post by:
Hi! I have labels on my page (some are web forms controls, and some are plain HTML labels), and I need Mozilla compatibile way for reading label value. For example, in IE I can use this:...
1
by: Andrew Banks | last post by:
I've got the following code in a control and the reader doesn't seem to be working. The connection details are correct. Any ideas? I am reading data from this database to log the user and a lot...
0
by: Steve B. | last post by:
Hi all, I'm looking for a pretty way to globalize an ASP.Net application. I base on the Globalization Architecture for ASP.NET article from the MSDN Library. If I have a user control...
3
by: Patrick.O.Ige | last post by:
I created a USERCONTROL and i want to call a LABEL from an ASPX page. The USERCONTROL is in the ASPX page I have the label :- Label lblstr = new Label(); And displaying using:-...
6
by: Joe | last post by:
I know that the Literal control will not render a <span> tag so I can not format its text. Other than this, what is the difference betwen the Literal control and the LiteralControl Control? How...
31
by: jcrouse | last post by:
Is there a quick and easy way to change the color of a label controls border from the default black to white? Thank you, John
2
by: semesm22 | last post by:
is there any way that i can create a click event for a label that is part of the web control library....i want to use a label in a user control, and when the user clicks one the user control i...
0
by: Mike Collins | last post by:
I someone can please help, I am about at an end in trying to figure this out. I am adding some dynamic controls to my page (I found out that I was supposed to be doing that in the oninit event,...
2
by: rn5a | last post by:
Consider the following code: <script runat="server"> Sub ShowData(obj As Object, ea As EventArgs) lblDate.Text = DateTime.Now.ToString("d") lblDate.DataBind() End Sub </script> <form...
0
by: Mark | last post by:
I want to create a user control inherited from a TextBox with an associated label (let's call it a LabelTextBox). The trick is that I want the control to inherit from TextBox and have all of its...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.