CSLA tag prefix

CSLA tag prefix

Old forum URL: forums.lhotka.net/forums/t/1111.aspx


uwillmore posted on Sunday, September 03, 2006

Hello all,

this is my first time using CSLA and I am running inot trouble with the csla tag prefix.I follow the project tracker web application example in the code download and added the controls block to my web.config file. I also added the csla datasource control to my toolbox in Visual Studio 2005 Pro. The project references csla.dll and csla.xmlserializer. My business objects are in a seperate library that is used company wide. I added that library as a second project to my solution. So my solution consists of 2 projects, the web application I am working on and the library project that contains my business object. That just for background, in case it matters.

My problem is very simple and may not be a problem, but here goes: I put the control on its own "sub menu" on the toolbox, so I have a CSLA section in the toolbox. Once I had the control in my toolbox I was finally able to use a csladatasource on my web page without the compiler complaining. But I noticed that the control has a cc1 tag prefix, not csla as shown in the example. I think what is happening is that Visual Studio is using cc1 because the csla control is my first custom control.

So my questions is 2 fold. Why does Visual Studio not recognize the csla prefix? and Does it matter?

Do I need add the tag prefix anywhere else? I did not see another place in the Project tracker web application that added the prefix except in the web.config file, but I could have missed something.

Any help would be appricated. The developer group at my office has avoided using csladatasource so far, because no one has been able to figure out the setup of the tag and the tag prefix. So if you can help me figure this out, we could finally start using CSLA in our web applications the they it is intended in version 2 (runtime version 2.0.5.727)

Thanks

uwillmore

Skafa replied on Sunday, September 03, 2006

It's not that hard :-) Visual Studio registers a control in the as(p/c)x file like this:

<%@ Register Assembly="Csla.dll" Namespace="Csla.Web" TagPrefix="cc1" %>

just change TagPrefix to csla

if you have registered the control in web.config you can always use the control without registering using <% @Register.

uwillmore replied on Tuesday, September 05, 2006

Well, unfortunately, it is NOT that easy. I found the register tag you mentioned and changed it as you suggested. But as soon as I do, I get an error for the <%@ Page directive The error is

Error 19 Identifier expected 

The code looks like this:

<%@ Page Language="C#" AutoEventWireup="true" Inherits="Heska.Orders.OrderIncident.OrderIncident" CodeFile="OrderIncident.aspx.cs" %>

<%@ Register Assembly="Csla" Namespace="Csla.Web" TagPrefix="csla" %>

If I change the tag prefix back to cc1 all is well.

Also, I have these lines in the web.config file, copied from the project tracker sample code:

<pages >

      <!-- Added controls block to reference csla custom data controls -->

      <controls>

            <add tagPrefix="csla" namespace="=Csla.web" assembly="Csla"/>

      </controls>

</pages>

I thought having the controls block in web.config set the prefix for the application and I would not need the <% @ Register directive in my pages at all.

I must be missing something, but I can't see it.

uwillmore

Copyright (c) Marimer LLC