Solved

vb.net Control not pulling code behind

Posted on 2014-07-21
7
470 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Regarding swagger API 1 35
why JSON Array data not binding on Model ASP.NET ? 1 29
Get sourcecode path 14 46
Web page design problem 3 14
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

749 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