Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

vb.net Control not pulling code behind

Posted on 2014-07-21
7
Medium Priority
?
478 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
  • 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

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 2000 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Loops Section Overview
Suggested Courses

773 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