Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Building Controls > building a server control using controlBuilder

Reply
Thread Tools

building a server control using controlBuilder

 
 
mr dropdown
Guest
Posts: n/a
 
      01-08-2006
A very useful answer from Mike MacMillan a few days ago helped me create the
server control I wanted. It is something like:
<Main:Control>
<Children>
<Collection1 value=1></Collection1>
<Collection1 value=2></Collection1>
<Collection2 value=3></Collection1>
<Collection2 value=4></Collection1>
</Children>
</Main:Control>

I'm soing it by using several controlBuilders, one for each HTML tag type.
The question is - how, in general, the cs file should look like? I mean, I
have several classes, several control builders etc.
First I wrote them 1 after the other in the root of the cs (inside the
nameSpace) but then I realized that it's not very smart because when creating
an instance of the control from a webForm page behind then after the name of
the instance variable you can see in the intellisense all the class and all
the controlBuilders! I tried to change the control builders "public" to
"private" or "protected" but the compiler didn't like it. Then I just removed
the word "public" and it worked fine - now I can't see the control builders
from the code-behind intellisense. The question is - how should I do it?? I
guess that answer won't be to remove the "public" from before the control
builder declaration.
Then I moved to the second problem - again in the interllisense, I could see
the following options -Children, Collection1 , Collection2. It doesn't make
sense. I wanted to see only children and then in the intellisense of children
to see Collection1 and Collection2.

My main question in here is - help. How should I arrange the server control
class so it will show in the interllisense only the relevant options and only
in the corrent location.

Thanks
 
Reply With Quote
 
 
 
 
mr dropdown
Guest
Posts: n/a
 
      01-08-2006
1. for each tag that i'm using in the asp.net page I created a new class
under the same namespace. I thought that since I'm going to have many
different tags it make sense to use this method. The problem is that now when
I'm adding the control to the asp.net toolbox, it adds a new item for each
class that I created, instead of just puting there the main class. Any
solution to this problem?
2. In all the sub-classes I'm just getting the tags data, but I'm not using
the Render method. Instead, I'm using only the Render method of the main
class to get all the tags data. Is that a correct way to work?
3. In the Render method - is there a special reason to work with:
writer.WriteBeginTag("img");
writer.WriteAttribute("src", src);
writer.WriteAttribute("alt", alt);
writer.Write(HtmlTextWriter.TagRightChar);
writer.WriteEndTag("img");

instead of the simple way:
write.write("<img src=x alt=y bla bla bla>");

Thanks!!


"mr dropdown" wrote:

> A very useful answer from Mike MacMillan a few days ago helped me create the
> server control I wanted. It is something like:
> <Main:Control>
> <Children>
> <Collection1 value=1></Collection1>
> <Collection1 value=2></Collection1>
> <Collection2 value=3></Collection1>
> <Collection2 value=4></Collection1>
> </Children>
> </Main:Control>
>
> I'm soing it by using several controlBuilders, one for each HTML tag type.
> The question is - how, in general, the cs file should look like? I mean, I
> have several classes, several control builders etc.
> First I wrote them 1 after the other in the root of the cs (inside the
> nameSpace) but then I realized that it's not very smart because when creating
> an instance of the control from a webForm page behind then after the name of
> the instance variable you can see in the intellisense all the class and all
> the controlBuilders! I tried to change the control builders "public" to
> "private" or "protected" but the compiler didn't like it. Then I just removed
> the word "public" and it worked fine - now I can't see the control builders
> from the code-behind intellisense. The question is - how should I do it?? I
> guess that answer won't be to remove the "public" from before the control
> builder declaration.
> Then I moved to the second problem - again in the interllisense, I could see
> the following options -Children, Collection1 , Collection2. It doesn't make
> sense. I wanted to see only children and then in the intellisense of children
> to see Collection1 and Collection2.
>
> My main question in here is - help. How should I arrange the server control
> class so it will show in the interllisense only the relevant options and only
> in the corrent location.
>
> Thanks

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ITemplate and ControlBuilder richard.szalay@gmail.com ASP .Net Building Controls 0 03-25-2007 11:19 PM
ASP.NET ControlBuilder with ITemplate Jonathan Gauthier ASP .Net Building Controls 0 11-10-2004 03:14 PM
ASP.NET ControlBuilder with ITemplate Jonathan Gauthier ASP .Net Web Controls 0 11-10-2004 02:29 PM
Help needed with AddParsedSubObject() and ControlBuilder() Chris Simeone ASP .Net Building Controls 0 10-29-2004 04:28 PM
Using custom ControlBuilder to parse deep nested sub controls? Sky ASP .Net Web Controls 4 07-19-2004 08:22 PM



Advertisments