+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / create event view title based on control property

create event view title based on control property

5 posts, 0 answered
  1. Amanda Shafer
    Amanda Shafer avatar
    198 posts
    Registered:
    12 Oct 2012
    03 Aug 2010
    Link to this post
    I am developing an intranet site that will have many Event View controls on a single page. For instance, we have "Upcoming Birthdays", "Upcoming Events", "Upcoming Training". Each are filtered based on category.

    I am using a custom control template. Right now I have numerous templates, one for Upcoming Birthdays, one for Upcoming Events, etc. so that I can have a title for each control.

    example code:
    <h2 class="sf_listTitle"> Upcoming Birthdays</h2>
      <ul class="sf_eventsList">
        </HeaderTemplate>
        <ItemTemplate>
                <li>
                <div id="BasicInfo" runat="server" class="sf_eventBasicInfo">
                               <span class='sf_eventPriod'>
                            <asp:Literal ID="Event_Start" runat="server" Text="{0}" />
                        </span>
                        <br />   
                  <span class='sf_eventTitles'>
                    <asp:HyperLink ID="fullContent1" runat="server"></asp:HyperLink>
                        <asp:Literal ID="Title" runat="server" />
                           </span> 

    .. and so forth.

    What I would like is to use one template that will dynamically pull the control title from the advanced properties tab of the control. This way I only need to maintain one template and can put the title in the advanced section under ID or a new field.

    How can I best accomplish this? Or is there a better way to go about this? (I have limited coding experience (more of a designer) and am new to Sitefinity.)

    Thanks!
                     
  2. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    04 Aug 2010
    Link to this post
    Hi Amanda Shafer,

    Thank you for contacting Telerik Support.

    This can be achieved with a custom control. What you have to do is to create a control which derives from events view control. Then introduce a new property - for example EventViewTitle. Then when your control is loaded on the page you will need to assign this value to a control in the template. Attached is a sample control which does this.

    Best wishes,
    Radoslav Georgiev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Amanda Shafer
    Amanda Shafer avatar
    198 posts
    Registered:
    12 Oct 2012
    05 Aug 2010
    Link to this post
    Thank you for responding.

    I understand your response up to this point, "Then when your control is loaded on the page you will need to assign this value to a control in the template." 
    In the code you provided, is there a custom control already there? I see the admin control templates which include the new field.  Or is the user control something that was not included and needs to be created yet, then uploaded via the "upload a control" on the page editor.
  4. Charu
    Charu avatar
    3 posts
    Registered:
    31 Jul 2010
    05 Aug 2010
    Link to this post

    Hello Radoslav,

     

    I had a similar problem and I have been trying to use the attached sample, but I am having some issues.

    After I use all the files attached in the sample, I am able to see the Event List and the Event Detail. Now, I want to further customize the Event Detail page by adding a Register button. On click of that button, I would like to do some further action, but I am unable to retrieve the Event Title on that page. It is displayed correctly in the Detail User Control, but I cannot seem to modify the User Control to add my custom code. Or if I try to add another custom user control on the same page, then I cannot retrieve the Event Title of the Event I am on.

    I must be really missing something very basic.

     

    Please help.

     

    Thanks,

    Charu

  5. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    09 Aug 2010
    Link to this post
    Hi,

    The control I have sent is ready for use. You have to add it to the Sitefinity toolbox using this line of web.config and use this control instead of the built in one:
    <toolboxControls>
     <clear />
     ...
     <add name="Custom Events View" section="Custom Controls" type="CustomEventsView, App_Code" />
     ...
    </toolboxControls>


    All the best,
    Radoslav Georgiev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Register for webinar
5 posts, 0 answered