Apr 01, 2011, 8:53 PM
[CLOSED] Dataview Templates and server-side code integration
Integrating server-side variables into a template is a huge pain. Is there a better way to do this? I've tried a million different things and each one has it's own issues.
In this implementation, {name} doesn't show up in the new template. Nor does anything else in the store.
In this implementation, {name} doesn't show up in the new template. Nor does anything else in the store.
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
dvMemberIconView.Template.Html = @"<tpl for"".""><p>{name}</p>
<tpl if=""'" + Page.User.Identity.IsAuthenticated.ToString() + @"' == 'True'"">
<a href=""/User/Profiles"" >{#}. edit profile</a>
</tpl>";
}
</script>
<ext:Store runat="server" ID="memberStore">
<Proxy>
<ext:HttpProxy Method="POST" Url="/Group/GetAllMembers/" />
</Proxy>
<Reader>
<ext:JsonReader IDProperty="UserId" Root="data" TotalProperty="total">
<Fields>
<ext:RecordField Name="UserId" />
<ext:RecordField Name="name" />
<ext:RecordField Name="path" />
<ext:RecordField Name="profile_name" />
</Fields>
</ext:JsonReader>
</Reader>
</ext:Store>
<ext:Panel
runat="server"
ID="ImagePanel"
Layout="Fit" >
<Items>
<ext:DataView ID="dvMemberIconView"
runat="server"
StoreID="memberStore"
AutoHeight="true"
OverClass="x-view-over"
ItemSelector="div.thumb-wrap"
EmptyText="No Members">
<Template ID="TemplateMember" runat="server">
<Html>
this will be replaced
</Html>
</Template>
</ext:DataView>
</Items>
</ext:Panel>
Last edited by Daniil; Apr 09, 2011 at 12:52 PM.
Reason: [CLOSED]