More in this section

Forums / Developing with Sitefinity / Events Module + Pre-fill Fields

Events Module + Pre-fill Fields

2 posts, 0 answered
  1. WebGeek
    WebGeek avatar
    186 posts
    Registered:
    20 Dec 2006
    11 Jun 2008
    Link to this post
    90% of all of my events occur at the same location and have the same contact information.  Is there any way that I can pre-fill these items in the add event module and also be able to change them if needed for my other 10% of events?
  2. Joe
    Joe avatar
    64 posts
    Registered:
    05 Jul 2012
    11 Jun 2008
    Link to this post
    In SiteFinity most, if not all of in the data for each module in the /SiteFinity/Admin/ControlTemplates/<ModuleName>/ControlPanelInsert.ascx file. Replace the <ModuleName> with name of the module. In your case the file would be /SiteFinity/Admin/ControlTemplates/Events/ControlPanelInsert.ascx.

    Unfortunately the default values exists in both the resource file (resx) and the user control (ascx). To change the defaults, you would have to open up both the user control file /SiteFinity/Admin/ControlTemplates/Events/ControlPanelInsert.ascx and the resource file, /SiteFinity/Admin/ControlTemplates/Events/App_LocalResources/ControlPanelInsert.ascx.resx.
    Once the file is open look for the <asp:TextBox> tags, most of these are used for the input.  The event title field can be found in the resource file and most other ones are located in the user control. 

    If your location is the same, edit the /SiteFinity/Admin/ControlTemplates/Events/ControlPanelInsert.ascx and look for the <asp:Literal ID="ltrEventLocation" tag, around line 216. The code looks like this...

    1<li> 
    2  <asp:Label ID="lblLocationName" runat="server" Text='<%$Resources:LocationName %>' AssociatedControlID="LocationName"></asp:Label> 
    3  <asp:TextBox ID="LocationName" runat="server"></asp:TextBox> 
    4</li> 
    5<li> 
    6  <asp:Label ID="lblRoom" runat="server" Text='<%$Resources:Room %>' AssociatedControlID="Room"></asp:Label> 
    7  <asp:TextBox ID="Room" runat="server"></asp:TextBox> 
    8</li> 
    9<li> 
    10  <asp:Label ID="lblStreet" runat="server" Text='<%$Resources:Street %>' AssociatedControlID="Street"></asp:Label> 
    11  <asp:TextBox ID="Street" runat="server"></asp:TextBox> 
    12</li> 
    13<li> 
    14  <asp:Label ID="lblCity" runat="server" Text='<%$Resources:City %>' AssociatedControlID="City"></asp:Label> 
    15  <asp:TextBox ID="City" runat="server"></asp:TextBox> 
    16</li> 

    Change it to this...
    1<li> 
    2  <asp:Label ID="lblLocationName" runat="server" Text='<%$Resources:LocationName %>' AssociatedControlID="LocationName"></asp:Label> 
    3  <asp:TextBox ID="LocationName" runat="server" Text="Convention Center"></asp:TextBox> 
    4</li> 
    5<li> 
    6  <asp:Label ID="lblRoom" runat="server" Text='<%$Resources:Room %>' AssociatedControlID="Room"></asp:Label> 
    7  <asp:TextBox ID="Room" runat="server" Text="The Grandroom"></asp:TextBox> 
    8</li> 
    9<li> 
    10  <asp:Label ID="lblStreet" runat="server" Text='<%$Resources:Street %>' AssociatedControlID="Street"></asp:Label> 
    11  <asp:TextBox ID="Street" runat="server" Text="123 Main Street"></asp:TextBox> 
    12</li> 
    13<li> 
    14  <asp:Label ID="lblCity" runat="server" Text='<%$Resources:City %>' AssociatedControlID="City"></asp:Label> 
    15  <asp:TextBox ID="City" runat="server" Text="Hometown"></asp:TextBox> 
    16</li> 

    You will notice on lines 2, 7, 11, and 15 we added a Text property.  For the drop down list controls (Country) look for the line that contains the country for your event.  It will look like this...

    <asp:ListItem Text="UNITED STATES" Value="USA"></asp:ListItem> 
     

    and add the Selected property like this...

    <asp:ListItem Text="UNITED STATES" Value="USA" Selected="true"></asp:ListItem> 
     

    I hope this helps,
    Joseph Guadagno
    http://www.josephguadagno.net
    http://www.sevdnug.org (SiteFinity Site)

2 posts, 0 answered