Solved

vb.net Control not pulling code behind

Posted on 2014-07-21
7
465 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
Comment Utility
In aspx, you have

ClassName="CalendarUserControl"


in code behind, you have

Partial Class loginbox

Class name needs to match.
0
 

Author Comment

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

Expert Comment

by:CodeCruiser
Comment Utility
Can you show your code now? And also the code of the page in which you are using this user control.
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:runnerjp2005
Comment Utility
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
Comment Utility
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
Comment Utility
yes...sorry he cop and paste added a space instead for some reason.
0
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 500 total points
Comment Utility
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 run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

772 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now