locked
EntityRef not getting updated RRS feed

  • Question

  • User-1712241964 posted

    First of all, thank you to all of those that helped me get as far as I am(via thread: http://forums.asp.net/t/1350355.aspx )
    My end goal is utilizing DynamicData(primarily field templates, not page templates) to build on top of/integrate with an existing website(instance of "Community Server").
    What I've done, in testing, is integrate the "ExistingWebSite"(LINQ data model version) into a test Community Server website.
    I then moved the script from the code-behind file to the <script> portion of the "AddressBookNew.aspx" page.
    All worked 100%!.
    The final step was to integrate the script and controls from the "AddressBookNew.aspx" page into an existing page of the Community Server instance.
    The only aspect that stopped functioning is that the "Category" field does not get updated upon update.
    All script and controls were copied from fully functional "AddressBookNew.aspx" page in same website, utilizing same web.config, data model, etc...
    There are no intellisense or compilation errors of any kind.
    Any thoughts or observations would be greatly appreciated!

    ,Gary

    <%@ Page EnableViewState="false" Language="C#" AutoEventWireup="true" Inherits="CommunityServer.Controls.CSThemePage" MasterPageFile="AddrBook.Master" %>

    <%@ Import Namespace="System" %>

    <%@ Import Namespace="System.Data" %>

    <%@ Import Namespace="System.Configuration" %>

    <%@ Import Namespace="System.Collections" %>

    <%@ Import Namespace="System.Linq" %>

    <%@ Import Namespace="System.Web" %>

    <%@ Import Namespace="System.Web.Security" %>

    <%@ Import Namespace="System.Web.UI" %>

    <%@ Import Namespace="System.Web.UI.WebControls" %>

    <%@ Import Namespace="System.Web.UI.WebControls.WebParts" %>

    <%@ Import Namespace="System.Web.UI.HtmlControls" %>

    <%@ Import Namespace="System.Xml.Linq" %>

    <%@ Import Namespace="System.Web.DynamicData" %>

    <script runat="server" language="C#">

    void Page_Load()

    {

    int userID = CommunityServer.Components.CSContext.Current.User.UserID;

     

    if (!user.IsAnonymous)

    {

    string titleText = string.Format(CommunityServer.Components.ResourceManager.GetString("ViewUserProfile_UserFriendsActivity"), user.DisplayName);string aggRssUrl = CommunityServer.Components.SiteUrls.Instance().UserFriendsActivityRss(user.Username);

    }

    }

     

    DateTime lastDate = DateTime.MinValue;

    string lastDateKey = string.Empty;

    CommunityServer.Components.User user = CommunityServer.Components.CSContext.Current.User;

     

    public bool ShowDateHeader(string key, object date)

    {

    DateTime currDate = user.GetTimezone((DateTime)date).Date;if (currDate != lastDate || key != lastDateKey)

    {

    lastDateKey = key;

    lastDate = currDate;

    return true;

    }

    else

    return false;

    }

    protected void Page_Load(object sender, EventArgs e)

    {

    DynamicDataManager1.RegisterControl(ListViewContacts);

    DynamicDataManager1.RegisterControl(DetailsViewContact);

    }

    protected void LinkButtonInsert_Click(object sender, EventArgs e)

    {

    DetailsViewContact.ChangeMode(
    DetailsViewMode.Insert);

    }

    protected void DetailsViewContactInsert_ItemInserted(object sender, DetailsViewInsertedEventArgs e)

    {

    ListViewContacts.DataBind();

    ListViewContacts.SelectedIndex = -1;

    }

    protected void DetailsViewContact_ItemDeleted(object sender, DetailsViewDeletedEventArgs e)

    {

    ListViewContacts.DataBind();

    ListViewContacts.SelectedIndex = -1;

    }

    protected void DetailsViewContact_ItemUpdated(object sender, DetailsViewUpdatedEventArgs e)

    {

    ListViewContacts.DataBind();

    ListViewContacts.SelectedIndex = -1;

    }

    </script>

    <asp:Content ContentPlaceHolderID="tr" runat="server">

    </asp:Content>

    <asp:Content ContentPlaceHolderID="lcr" runat="server">

    </asp:Content>

    <asp:Content ContentPlaceHolderID="bcr" runat="server">

    <asp:DynamicDataManager ID="DynamicDataManager1" runat="server" />

    <table width="900">

    <tr>

    <td width="450" valign="top">

    <table>

    <tr>

    <th><asp:LinkButton ID="LinkButtonAdd" runat="server" onclick="LinkButtonInsert_Click">Add</asp:LinkButton></th>

    <th>First</th>

    <th>Last</th>

    <th>Email</th>

    <th>Company</th>

    <th>Work</th>

    </tr>

    <asp:ListView ID="ListViewContacts" runat="server" DataSourceID="LinqDataSourceContacts" DataKeyNames="ContactId">

    <LayoutTemplate>

    <asp:PlaceHolder ID="ItemPlaceHolder" runat="server"></asp:PlaceHolder>

    </LayoutTemplate>

    <ItemTemplate>

    <tr>

    <td><asp:LinkButton ID="LinkButton1" runat="server" CommandName="Select">select</asp:LinkButton></td>

    <td><asp:DynamicControl ID="DynamicControl1" runat="server" DataField="FirstName" /></td>

    <td><asp:DynamicControl ID="DynamicControl2" runat="server" DataField="LastName" /></td>

    <td><asp:DynamicControl ID="DynamicControl3" runat="server" DataField="EmailAddress" /></td>

    <td><asp:DynamicControl ID="DynamicControl4" runat="server" DataField="Company" /></td>

    <td><asp:DynamicControl ID="DynamicControl5" runat="server" DataField="WorkPhone" /></td>

    </tr>

    </ItemTemplate>

    <EmptyDataTemplate>

    <tr>

    <td align="center" colspan="6">

    No entries. <asp:LinkButton ID="LinkButtonInsert" runat="server" onclick="LinkButtonInsert_Click">Click to Add.</asp:LinkButton>

    </td>

    </tr>

    </EmptyDataTemplate>

    </asp:ListView>

    <asp:LinqDataSource ID="LinqDataSourceContacts" runat="server" ContextTypeName="AddressBookDataContext" Select="new (FirstName, LastName, EmailAddress, Company, HomePhone, WorkPhone, MobilePhone, ContactId)" TableName="Contacts">

    </asp:LinqDataSource>

    </table>

    </td>

    <td valign="top" width="450">

    <asp:DetailsView ID="DetailsViewContact" runat="server" Height="50px" Width="125px" AutoGenerateRows="false" DataKeyNames="ContactId" DataSourceID="LinqDataSourceetailsViewContact" AutoGenerateDeleteButton="true" AutoGenerateEditButton="true" AutoGenerateInsertButton="true" onitemdeleted="DetailsViewContact_ItemDeleted" onitemupdated="DetailsViewContact_ItemUpdated" oniteminserted="DetailsViewContactInsert_ItemInserted">

    <Fields>

    <asp:DynamicField DataField="Category" />

    <asp:DynamicField DataField="FirstName" />

    <asp:DynamicField DataField="LastName" />

    <asp:DynamicField DataField="Company" />

    <asp:DynamicField DataField="Title" />

    <asp:DynamicField DataField="Address" />

    <asp:DynamicField DataField="City" />

    <asp:DynamicField DataField="State" />

    <asp:DynamicField DataField="Zip" />

    <asp:DynamicField DataField="HomePhone" />

    <asp:DynamicField DataField="WorkPhone" />

    <asp:DynamicField DataField="MobilePhone" />

    <asp:DynamicField DataField="EmailAddress" />

    <asp:DynamicField DataField="Website" />

    <asp:DynamicField DataField="Birthdate" />

    <asp:DynamicField DataField="Anniversary" />

    </Fields>

    </asp:DetailsView>

    <asp:LinqDataSource ID="LinqDataSourceetailsViewContact" runat="server" ContextTypeName="AddressBookDataContext" EnableDelete="True" EnableInsert="True" EnableUpdate="True" TableName="Contacts" Where="ContactId == @ContactId">

    <WhereParameters>

    <asp:ControlParameter ControlID="ListViewContacts" DefaultValue="-1" Name="ContactId" PropertyName="SelectedValue" Type="Int32" />

    </WhereParameters>

    </asp:LinqDataSource>

    </td>

    </tr>

    </table>

    </asp:Content>

    <asp:Content ContentPlaceHolderID="rcr" runat="server">

    </asp:Content>

    Thursday, December 18, 2008 10:31 AM

All replies

  • User-1712241964 posted

    My appologies to the moderator for wasting a few minutes of their time.
    Found the issue moments after posting.
    I'll explore what the consequences might be for the Community Server controls, etc... but removing "EnableViewState="false"" returned the lost functionality.
    ,Gary

    Thursday, December 18, 2008 11:16 AM