HTML隐藏字段在asp.net vb中不起作用 [英] html hidden field not working in asp.net vb
本文介绍了HTML隐藏字段在asp.net vb中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
正在使用vb.net面对一个asp.net服务器端问题
问题是我在页面中声明了一个html输入隐藏字段,名称是hidden1.
但是当我要在服务器端代码中调用该名称时,我得到了以下错误,
未声明名称"Hidden1"
请在下面查看我的代码,
Hi All,
am facing one asp.net server side issue using vb.net
the problem is i declared one html input hidden field in my page, the name is hidden1.
but when i going to call that name into server side code, that time i got the below error,
Name "Hidden1" is not declared
please have a look at my code below,
Default.aspx
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="WebApplication2._Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<input id="Hidden1" type="hidden" runat="server" />
</div>
</form>
</body>
</html>
Default.aspx.vb
Partial Public Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Hidden1.Value = "" '' getting error like ->Name "Hidden1" is not declared
End Sub
End Class
在此先感谢..
thanks in advance..
推荐答案
在.vb页面中将_Default类名称更改为WebApplication2._Default.
Change your _Default Class name to WebApplication2._Default in your .vb page
Partial Public WebApplication2._Default
Inherits System.Web.UI.Page
问候,
阿里夫·谢赫(AARIF SHAIKH)
Regards,
AARIF SHAIKH
这篇关于HTML隐藏字段在asp.net vb中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文