Click here to Skip to main content
15,891,812 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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,


ASP.NET
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>





VB.NET
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..
Posted
Updated 5-Jan-16 23:58pm
v2
Comments
Kornfeld Eliyahu Peter 6-Jan-16 6:06am    
Call base's OnLoad before you try to access it...

1 solution

Change your _Default Class name to WebApplication2._Default in your .vb page

C#
Partial Public WebApplication2._Default
    Inherits System.Web.UI.Page


Regards,
AARIF SHAIKH
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900