I have the following html codes (to be used in POST method):
// from Default.aspx
<input type="hidden" name="lblName" value="John" />
<input type="hidden" name="price" value="100.00" />
Is it possible to change the ‘value’ part by using the value/text ASP.NET label given below:
//from Default.aspx.cs
<asp:Label ID="lblName" runat="server" Text="John" />
<asp:Label ID="lblPrice" runat="server" Text="100.00" />
I just want to find a way to retrieve ‘value’ data dynamically coming from the ASP.NET label.
Any suggestions?
Why not using a server side hidden control whose values could be modified dynamically from the server side:
Another possibility is to perform this on the client side using javascript: labels are usually rendered as
spantags, so you will need to obtain the proper span by id and then assign it’sinnerHTMLvalue to the hidden element. Using a javascript framework like jQuery might render this task much easier and guaranteed to work cross browser.