c# - Web Control Properties -


i make web control more readable in design mode, want tag declaration like:

<cc1:ctrl id="value1" runat="server">              <values>string value 1</value>      <values>string value 2</value> </cc1:ctrl> 

lets have private variable in code behind:

list<string> values = new list<string>(); 

so how can make user control fill out private variable values declared in markup?


sorry should have been more explicit. functionality itemplate provides (http://msdn.microsoft.com/en-us/library/aa719834.aspx)

but in case need know @ runtime how many templates can instansitated, i.e.

void page_init() { if (messagetemplate != null) {     (int i=0; i<5; i++) {         messagecontainer container = new messagecontainer(i);         messagetemplate.instantiatein(container);         msgholder.controls.add(container);     } } 

}

in given example markup looks like:

<acme:test runat=server>    <messagetemplate>     hello #<%# container.index %>.<br>    </messagetemplate> </acme:test> 

which nice , clean, not have tag prefixes etc. want nice clean tags.

i'm being silly in wanting markup clean, i'm wondering if there simple i'm missing.

i think searching attribute:

[persistencemode(persistencemode.innerproperty)] 

persistence mode

remember have register namespace , prefix with:

<%@ register namespace="mynamespace" tagprefix="pref" %> 

Comments

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -