Code Blocks in Custom Control

D

Darrin Boyd

I have developed a custom control and I want to allow the
user to insert code blocks in the .aspx (or .ascx) file to
set attributes on the control. For example, I want to
allow the user to do this:

&lt;pwc:SortColumn HeadingText='<%=GetHeadingText(0)%
&lt;pwc:SortColumn HeadingText='<%=GetHeadingText(1)%

* The GetHeadingText(int colIndex) is a protected method
in the codebehind .cs file.

When the custom control is parsed, the default parser is
not seeing this attribute as a code block. It only sees
it as a string. Is there any way to use a custom
ControlBuilder to force the parser to evaluate this and
call the code behind method?

Thanks,
Darrin Boyd
(e-mail address removed)
 
R

Rory

why dont you just have a property that when set, calls the
GetHeadingText() method from within your control, and say
populates a private property with the heading text. You
can then use this result to populate the below code.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,565
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top