Solved

ASP.Net VB: View HiddenField value

Posted on 2007-11-27
2
1,342 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

920 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now