Thursday, March 22, 2012

HTML control value to an ASP.NET value

Hi. I have the following HTML Control and I want to access the value in my asp.net code.

<INPUT ID="hdnFPrintNA" runat=server STYLE="Z-INDEX: 163; LEFT: 165px; WIDTH: 38px; POSITION: absolute; TOP: 5px; HEIGHT: 22px" TYPE="hidden" SIZE="1">
--------------
When the user presses my Server control button to clear the screen, I would like to clear the hidden text field as well. The below doesn't work.

Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click

hdnFPrintNA.Text = ""

End Sub
-------------
I have been searching this site to try and find the answer but I am only getting confused. Can any one point me in the right direction and tell me how to solve this problem?

ThanksI think it should read

hdnFPrintNA.value =""
Try using "hdnFPrintNA.Value" instead. And also remember to define your Html Control as:

'System.Web.UI.HtmlControls.HtmlInputHidden'
Thank you both for your help. It works now. :)

No comments:

Post a Comment