Ask a Question related to ASP.NET General, Design and Development.
-
Charles A. Lackman #1
className Attribute (UserControls)
Hello, I am reading a book on ASP.NET Applications and don't understand what
the writer is trying to say. It is stated that (when converting a Web Page
to a User Control) that:
"Adding a className attribute to the @Control directive allows you to
specify the class name for the user control and it allows strong typing of
the control when it's added to the page or other server controls
programmatically."
Does this mean that using a className attribute will allow me to use the
code-behind page to add the control to my ASP.NET page? I have tried this
and if this is what it means them I am going something wrong. If I am
missunderstanding what the author is saying can you please give me a code
example (either way) of what is being said.
Thanks
Chuck
Charles A. Lackman Guest
-
Retrive data from attribute spaced attribute.
Hi. I'm retrieving data from an excel sheet. But one of the attributes is name "Phone private". This is a problem when I want to write out the... -
#24729 [Ver->Csd]: $obj = new $className; causes crash when $className is not set
ID: 24729 Updated by: helly@php.net Reported By: proton at fangen dot net -Status: Verified +Status: ... -
#24729 [Opn->Ver]: $obj = new $className; causes crash when $className is not set
ID: 24729 Updated by: derick@php.net Reported By: proton at fangen dot net -Status: Open +Status: ... -
#24729 [NEW]: $obj = new $className; causes crash when $className is not set
From: proton at fangen dot net Operating system: Windows XP Home PHP version: 5CVS-2003-07-20 (dev) PHP Bug Type: ... -
global.asax classname
i have the following in global.asax: <%@ Application Codebehind="Global.asax.cs" Inherits="Foo.Global" Classname="AppClass" %> but wherever i... -
Unregistered #2
Re: className Attribute (UserControls)
yes that is true, by adding a classname attribute to the user controls ascx file you should be able to load the control from code behind. So:
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="CustomBasketsSummary.ascx.cs"
ClassName="CustomBaskets.CustomBasketsSummaryContr ol" Inherits="CustomBaskets.CustomBasketsSummary" %>
by having the above in the user control you can then load this control in a different page or control using its strongly typed name:
Controls.Add(LoadControl(typeof(CustomBaskets.Cust omBasketsSummaryControl), null));Unregistered Guest



Reply With Quote

