inputhtmlhidden

flo

New member
Joined
Jul 6, 2003
Messages
4
Im new in .NET and using codebehind. I have first.aspx and codes in .aspx.vb.

Is it possible to get the value of input field?

.aspx
<input type="hidden" name="hfCode" value="YES">

.aspx.vb
Private Sub btSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btSave.Click

? i want to get the value of hfCode.

End Sub

Any help is very much appreciated.

Thanks.
 
Do this
ASPX
<input type="hidden" id="MyField" Runat="Server" name="hfCode" value="YES">

ASPX.VB
Private Sub btSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btSave.Click

MyField.Value gives the text inside the field
End Sub

This is because ASPX can only access Server Side Controls and not Client Side Controls. To make an Html control a server control simply add the RunAt="Server" and give it an Id

Hope this helps
 
Back
Top