Ask a Question related to ASP.NET Building Controls, Design and Development.
-
Eric #1
Accessing custom control properties
Hello, I've created a custom control and want to set
properties in the aspx page.
<%@ Page language="c#" Codebehind="test_control2.aspx.cs"
AutoEventWireup="false"
Inherits="oldtownclovis_dotnet.test_control2" %>
<%@ Register TagPrefix="aspCustomerGrid"
TagName="CustomerGrid" Src="test_user_control.ascx"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0
Transitional//EN" >
<html>
<head>
<title>test_control2</title>
<LINK rel="stylesheet" type="text/css"
href="http://localhost/oldtownclovis_dotnet/include/otc_nor
mal.css">
</head>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<aspCustomerGrid:CustomerGrid
id="CustomerGrid" runat="server">
<!-- can i set the properties
here? -->
</aspCustomerGrid:CustomerGrid>
</form>
</body>
</html>
How do I set the public properties of the control from
within the customer control's tag?
Thanks,
Eric
Eric Guest
-
Making Custom Control Properties Visible in Visual Studio's Properties Palette
I am learning how to use the System.ComponentModel class in VB.NET so that I can add my ASP.NET controls to Visual Studio .NET 2003. I have managed... -
Building a non-databound custom template and accessing it's properties
Hello, I've built a custom control (inherits from WebControls.Repeater) with a custom template. The intention is to make a custom paging... -
Accessing properties in custom control
Hi all, This is probably a newbie question, but... I have a custom control inherited from System.Web.UI.WebControls.Table. Here is the code: ... -
User Control - Accessing Properties from the Container Page
Dear all, Please check my problem - Problem: I have created a User Control(UC1) for navigating between pages. There are 4 buttons on the user... -
Accessing TreeView Control properties on the client side
Hi , I want to disable (AutoPostBack) for the tree . So on the click event I am able to retrieve the index of the node clicked on the client... -
Victor Garcia Aprea [MVP] #2
Re: Accessing custom control properties
Hi Eric,
Define a public property in your user control class and then add an
attribute to the usercontrol tag named after your property, ie:
[C#]
public String YourProperty {
get{ ... }
set{ ... }
}
..ASPX
<prefix:YourUSerControlType runat="server" YourProperty="blah" />
You won't be able to set this property using the Properties window at
design-time, you will need to directly edit the markup, thats a limitation
in the current bits.
--
Victor Garcia Aprea
Microsoft MVP | ASP.NET
Looking for insights on ASP.NET? Read my blog:
[url]http://obies.com/vga/blog.aspx[/url]
To contact me remove 'NOSPAM'. Please post all questions to the newsgroup
and not by private mail.
"Eric" <benzrider2000@yahoo.com> wrote in message
news:041e01c398e9$77b81320$a401280a@phx.gbl...> Hello, I've created a custom control and want to set
> properties in the aspx page.
>
> <%@ Page language="c#" Codebehind="test_control2.aspx.cs"
> AutoEventWireup="false"
> Inherits="oldtownclovis_dotnet.test_control2" %>
> <%@ Register TagPrefix="aspCustomerGrid"
> TagName="CustomerGrid" Src="test_user_control.ascx"%>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0
> Transitional//EN" >
>
> <html>
> <head>
> <title>test_control2</title>
> <LINK rel="stylesheet" type="text/css"
> href="http://localhost/oldtownclovis_dotnet/include/otc_nor
> mal.css">
> </head>
> <body MS_POSITIONING="GridLayout">
>
> <form id="Form1" method="post" runat="server">
> <aspCustomerGrid:CustomerGrid
> id="CustomerGrid" runat="server">
> <!-- can i set the properties
> here? -->
> </aspCustomerGrid:CustomerGrid>
> </form>
>
> </body>
> </html>
>
>
> How do I set the public properties of the control from
> within the customer control's tag?
>
> Thanks,
>
> Eric
Victor Garcia Aprea [MVP] Guest



Reply With Quote

