Set C# Inline Expressions in ASP.NET Controls On Server-Side -


is possible programatically insert c# inline expressions values asp.net controls in server-side code?

i'm using datalist display lot of data in table. want able dynamically change columns of table, need able edit controls in itemtemplate.

however, in addition editing controls in itemtemplate, need able alter value binded each control in template, because want dynamically change being displayed.

so have static table doesn't change:

<asp:datalist id="datalist" runat="server" onselectedindexchanged="datalist_onselectedindexchanged" datasourceid="peopledata">     <itemtemplate>         <table>             <tr>                 <td>                     <asp:linkbutton id="namelink" onclientclick="onpageupdate()" commandname="select" text='<%# eval(this.name) %>' forecolor='<%# eval("this.namecolor") %>' runat=server" />                 </td>                 <td>                     <asp:label text='<%# eval("this.values[\"age\"]") %>' forecolor='<%# eval("this.valuecolors[\"age\"]") %>' runat="server">                 </td>                 // other columns different data             </tr>         </table>     </itemtemplate> </asp:datalist> // object data source code 

i know how dynamically add controls aspx web page. however, don't know how add inline expressions.

i've tried doing following doesn't work because of type mismatches:

label label = new label(); label.text = "<%# eval(\"this.values[\\\"age\\\"]\") %>"; label.forecolor = "<%# eval(\"this.valuecolors[\\\"age\\\"]\") %>"; 

is there way of achieving or doing similar?

my other option can think of right scrap using datalist , itemtemplate , generate each row myself.. that's lot more coding versus using itemtemplate.

not sure if you, @ http://msdn.microsoft.com/en-us/library/system.web.ui.databinder(v=vs.100).aspx

it showing using of hand-written exposure of properties. if property call "magic" , return appropriate value magic within code need?


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -