Click here to Skip to main content
15,891,431 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
1

this text is in span tag

The inner text will be 1 or 2 or 3... Till 10

How can i get this span text in C#
Posted

1 solution

Hi Kishore

try this ,

aspx:
ASP.NET
<span id="spancontrol" runat="server">content</span>


code behind:
C#
var text =  spancontrol.InnerText;


Note:
If the span value is changed in the client side ( javascript ). It wont reflect in the code behind (.cs). [spancontrol.InnerText will contain the original value only]
 
Share this answer
 
Comments
Kishor Khatri 26-Dec-13 1:25am    
the problem is that i cann't do this,,, i can not add runat = "server" property
but thanx i solved it myself
Karthik_Mahalingam 26-Dec-13 1:28am    
you can use hidden field to solve this issue.
Kishor Khatri 26-Dec-13 1:30am    
Thanx karthik, i solved it in the same way
Karthik_Mahalingam 26-Dec-13 1:31am    
ok :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900