Answered by:
Using Custom Control in code behind

Question
-
User-1103495211 posted
I've build a control for testing.
Right now it works great, but i only specify things in de aspx code, example:<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="MatchMaker3._Default" %>
<%@ Register Assembly="TestTableNav" Namespace="TestTableNav" TagPrefix="Test" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<Test:TestTableNav ID="TestNav1" runat="server" Text="Header Text" Mode="TestPage"/>
</div>
</form>
</body>
</html><html>
So thought, i could acces it in the code behind like:
TestNav1.Text = "Hellow";But that doesnt work??? How can i add it from code behind?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;namespace Appl
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
TestNav1.Text = "Hellow";
}
}
}Monday, February 22, 2010 7:57 AM
Answers
-
User-77825112 posted
Maybe it's about the namespace? Or did you change it when you copy paste it here?
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="MatchMaker3._Default" %
namespace Appl
{
public partial class _Default : System.Web.UI.Page
}
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Tuesday, February 23, 2010 7:54 PM
All replies
-
User-1659704165 posted
Hi,
http://msdn.microsoft.com/en-us/library/aa719973%28VS.71%29.aspx
//dersign time Attributes..
http://msdn.microsoft.com/en-us/library/tk67c2t8%28VS.71%29.aspx
chk the above link every thing well explined
Monday, February 22, 2010 8:03 AM -
User-1103495211 posted
Code looks fine, should work right this?
Can anyone help me whats wrong?Monday, February 22, 2010 9:23 AM -
User-77825112 posted
Maybe it's about the namespace? Or did you change it when you copy paste it here?
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="MatchMaker3._Default" %
namespace Appl
{
public partial class _Default : System.Web.UI.Page
}
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Tuesday, February 23, 2010 7:54 PM