Solved

ASP.Net VB: View HiddenField value

Posted on 2007-11-27
2
1,346 Views
Last Modified: 2010-05-18
I would like to view the value of a hidden field to make sure it is getting a value.  This is the code I have in the code-behind page:

hdnPaidThruDateA.Value = CDate(result).ToString("MM/yyyy")

This is the code in the .aspx page:

<asp:HiddenField ID="hdnPaidThruDateA" Value="hdnPaidThruDateA" Visible="true" runat="server" />  

I have Visible="true" which I am assuming that if the value is in the .aspx hidden value field, I should be able to see it.  When the page is rendered I don't see the value.  If I'm doing this incorrectly how can I see the value?

Thanks.

John
0
Comment
Question by:jcpatterson
2 Comments
 
LVL 3

Accepted Solution

by:
bcaff86 earned 125 total points
ID: 20361544
I believe setting visible="true" on a hidden field is a waste of time as it will always be hidden.

When I've run into this in the past I've used a text field and just set the style="display:none;".

Works the same as a hidden field but it will be rendered in your markup everytime.
0
 
LVL 8

Expert Comment

by:arhame
ID: 20362116
Easiest way to see values you're trying to set, I've found, is to just use response.write()  So in the codebehind, after you do:
hdnPaidThruDateA.Value = CDate(result).ToString("MM/yyyy")

To see the value it assigned, just:

Response.Write(hdnPaidThruDateA).Value

After you've seen that it's getting the proper value, just delete the response.write.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question