late-bound-evaluation

How to call extension methods using Eval in a databound control

I have a simple extension method on the int type so I can do the following: string timeLength = 61.ToTime() // timeLength will be "1:01" This works great in code, but I want to use this extension method in a Repeater Template. When databinding I want to do the following: <%# Eval("LengthInSeconds").ToTime() %> That didn't work so I...

Enabling Databound List Items in DropDownList

I have a drop down list that is being used in an EditItemTemplate of a DetailsView, and it is being populated from a SqlDataSource, and I am binding the selected value as follows: <EditItemTemplate> <asp:DropDownList ID="lstLocations" runat="server" DataSourceID="sqlMDALocationsAll" DataTextField="loc_name" DataValueField=...

Trying to embed a DataItem within an asp:Image control's ImageUrl property

I have the following Image control within a repeater. I'm trying to get the username to render in between ~/profilepics/ and .jpg but I get the following rendered output /profilepics/%3C%25#DataBinder.Eval(Container.DataItem,%20%22usernameFrom%22)%20%25%3E.jpg Here is the markup <asp:Image ID="Image1" runat="server" ImageUrl='~/profil...

C# - Disable Dynamic Keyword

Is there any way to disable the use of the "dynamic" keyword in .net 4? I thought the Code Analysis feature of VS2010 might have a rule to fail the build if the dynamic keyword is used but I couldn't fine one. ...