Solved

vb.net Control not pulling code behind

Posted on 2014-07-21
7
468 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
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

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.…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

786 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