473,396 Members | 2,052 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How to retrieve <asp:label> value from the code behind in c#

Hello frens i want to retrieve <asp:label> value from the code behind in c#
can any one help me...
Aug 7 '07 #1
8 4473
dip_developer
648 Expert 512MB
Hello frens i want to retrieve <asp:label> value from the code behind in c#
can any one help me...
what is the problem with Label1.Text...?????

What is ur actual problem......????
Aug 7 '07 #2
what is the problem with Label1.Text...?????

What is ur actual problem......????

<asp:Label ID="txt" runat="server" ></asp:Label>
Actually i wrote this in the asp page now i want retrieve that value from the c#

In c# i wrote like this


TableCell docname = e.Item.Cells[1];
txt.Text = docname.Text;
Request.Form(txt.Text);
Is it correct..
Aug 7 '07 #3
kenobewan
4,871 Expert 4TB
I suggest taking a course or buying a good book to get the basics. Once you assign the label a value you already have it why would you need to request it? Usually you use request.form for a field posted from another page. HTH.
Aug 7 '07 #4
Plater
7,872 Expert 4TB
If you create an object in your asp page like this:
<asp:Label ID="txt" runat="server" ></asp:Label>

Then in your backend code you can say:
string mylabelvalue= txt.Text;

Or any other various uses. I recomend the usage of CTRL+{SpaceBar] (that's the auto-complete)
Aug 7 '07 #5
If you create an object in your asp page like this:
<asp:Label ID="txt" runat="server" ></asp:Label>

Then in your backend code you can say:
string mylabelvalue= txt.Text;

Or any other various uses. I recomend the usage of CTRL+{SpaceBar] (that's the auto-complete)
i want to assign the value from backend
string mylabelvalue= txt.Text;

if i give this "mylabelvalue" takes the "txt.Text" value

but my intention is txt.Text value has to be taken from the backend and it should be displayed in the frontend
Aug 8 '07 #6
Plater
7,872 Expert 4TB
Ok then do this:

In your frontend code:
<asp:Label ID="txt" runat="server" ></asp:Label>

Then in your backend code you can say:
txt.Text="whatever I feel like making this text be, this is a pretty simple example that you should have been able to see from the last post";
Aug 8 '07 #7
Ok then do this:

In your frontend code:
<asp:Label ID="txt" runat="server" ></asp:Label>

Then in your backend code you can say:
txt.Text="whatever I feel like making this text be, this is a pretty simple example that you should have been able to see from the last post";
Thank U... sir for replying i got solution..
Aug 9 '07 #8
Plater
7,872 Expert 4TB
Hehe, sorry for sounding a bit rude. I do this at work and forget myself sometimes
Aug 9 '07 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: John Smith | last post by:
I created a dataTable that returns a value from a stored procedure. How would I bind that results of a query to an <asp:label>? Thank you!
6
by: Andreas Klemt | last post by:
Hello, when I use <asp:label font-size="16px" text="Hello World" runat="server" /> and run FireFox Browser the output of "Hello World" is not in Size 16px. The size will be ignored and I can...
5
by: Johnb41 | last post by:
I want an "order number" to be displayed more than once on my page. <script language="vb" runat="server"> ... dim ordernumber as string = "123456" page.databind() ... </script>
3
by: nick | last post by:
Is possible for server side code to access the text of <asp:label> changed by client side javascript code?
4
by: Satya | last post by:
Hi all, The following code is throwing a run time error "The server tag is not well formed. " <ItemTemplate> <asp:HyperLink Runat="server" ID="lnkFile"...
2
by: xzzy | last post by:
I need to update the .Text of a label until the user logs out. but get this error: Error: Method name expected I have listed the code below and the offending line of code is delimited by ...
4
by: mark.norgate | last post by:
Why oh why does my <asp:labelrevert to its initial value, having been changed programmatically, when I click a button in a user control I have added dynamically to the page? It's EnableViewState is...
3
by: =?Utf-8?B?U21pdGE=?= | last post by:
Hello all, I have a gridview, and a label inside the <Columnsand ItemTemplate. The label is a hidden. I want to retrieve the value of this label on the gridview_OnPageIndexChanged event, but i...
3
by: Homer J. Simpson | last post by:
I have the following stored procedure: ALTER PROCEDURE . AS BEGIN SET NOCOUNT ON; SELECT COUNT(*) FROM QUICKNOTES END ....and the following data source in my .aspx file:
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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,...
0
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
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.