Solved

vb.net Control not pulling code behind

Posted on 2014-07-21
7
473 Views
Last Modified: 2014-07-22
Hello - i have my control working from the front end but the back-end is not pulling the code from behind - am i missing a tag?
loginbox.ascx
<%@ Control Language="VB" CodeBehind="loginbox.ascx.vb" ClassName="CalendarUserControl" %>  

<asp:Label text="yo" ID="Label1" runat="server" Font-Size="Large" ForeColor="DarkGreen"></asp:Label> 

Open in new window


loginbox.ascx.vb

Partial Class loginbox

System.Web.UI.UserControl

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
	
	  Label1.text="yolo"
    End Sub

Open in new window

0
Comment
Question by:runnerjp2005
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 40208769
In aspx, you have

ClassName="CalendarUserControl"


in code behind, you have

Partial Class loginbox

Class name needs to match.
0
 

Author Comment

by:runnerjp2005
ID: 40209038
I have changed the above and the code behind still does not work
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 40209193
Can you show your code now? And also the code of the page in which you are using this user control.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:runnerjp2005
ID: 40209212
loginbox.ascx

<%@ Control Language="VB" CodeBehind="loginbox.ascx.vb" ClassName="loginbox" %>  

<asp:Label text="yo" ID="Label1" runat="server" Font-Size="Large" ForeColor="DarkGreen"></asp:Label> 

Open in new window


loginbox.ascx.vb
Partial Class loginbox

System.Web.UI.UserControl

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
	
	  Label1.text="yolo"
    End Sub

    
End Class

Open in new window


default.aspx (where its included)

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="home" %>
<%@ Register src="loginsystem/loginbox.ascx" tagname="CalendarUserControl" tagprefix="uc1" %>  

<!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">
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
    <title>Running Profiles</title>
   <link href="rp.css" rel="stylesheet" type="text/css" />
</head>
<body>

<div id="header_container">
    <div id="header">
  <div id="titlehead">
Running Profiles   <div id="loginbutton" style="float:right;"> Login </div>
  </div>
 
    </div>
</div>
<!-- <div id="top-header">-->

<!-- </div>-->
	<!-- <div id="topheader-split"> -->
	<!-- <div id="topheader-split2"> -->
	<!-- </div> -->
	<!-- </div> -->
<div id="content">
<div id="content2">

<div id="topcontent">
<img src="images/logo.png" style="float:left;margin-left:25px;margin-bottom:25px;border:0px;" alt="mylogo" width="300px" height="188px" />
<div id="rpheader"> Welcome To Running Profiles </div>
<div id="rpsubheader">- Record And Share Your Training Online -</div>
</div>


<hr class="style-two" />
 
<uc1:CalendarUserControl ID="CalendarUserControl1" runat="server" />
 
</div>
</div>

</body>
</html>

Open in new window

0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 40209302
From the code behind of your user control

Partial Class loginbox

System.Web.UI.UserControl

should it not be

Partial Class loginbox
Inherits
System.Web.UI.UserControl
?
0
 

Author Comment

by:runnerjp2005
ID: 40210958
yes...sorry he cop and paste added a space instead for some reason.
0
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 500 total points
ID: 40211169
Another option is to put the vb code within the same file as shown in the example on MSDN

http://msdn.microsoft.com/en-us/library/26db8ysc(v=vs.85).aspx
0

Featured Post

How To Reduce Deployment Times With Pre-Baked AMIs

Even if we can't include all the files in the base image, we can sometimes include some of the larger files that we would otherwise have to download, and we can also sometimes remove the most time-consuming steps. This can help a lot with reducing deployment times.

Question has a verified solution.

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

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…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

628 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