473,796 Members | 2,712 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

4 New Member
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 4525
dip_developer
648 Recognized Expert Contributor
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
gelligokul
4 New Member
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(tx t.Text);
Is it correct..
Aug 7 '07 #3
kenobewan
4,871 Recognized Expert Specialist
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 Recognized Expert Expert
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
gelligokul
4 New Member
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 Recognized Expert Expert
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="whate ver 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
gelligokul
4 New Member
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="whate ver 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 Recognized Expert Expert
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
1592
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
2932
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 not find it in the HTML Source Code. Why is it a problem with FireFox and what is the solution how to set sizes in Labels?
5
1427
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
3456
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
2219
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" NavigateUrl="javascript:OpenImage('<%# DataBinder.Eval(Container.DataItem,"FileName") %>');"><%#
2
1530
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 //The next line breaks: Error: Method name expected
4
1363
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 set to true. Mark
3
7402
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 seem to get a nullexception. Can anyone please tell me what iam doing wrong. When i do the "view source" option i do see the values in the label. thanks for all the help
3
2578
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
9673
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9524
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10217
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10168
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10003
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6785
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5568
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4114
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2924
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.