Important Notice from AspDotNetStorefront
It is with dismay that we report that we have been forced, through the action of hackers, to shut off write-access to this forum. We are keen to leave the wealth of material available to you for research. We have opened a new forum from which our community of users can seek help, support and advice from us and from each other. To post a new question to our community, please visit: http://forums.vortx.com
Results 1 to 2 of 2

Thread: Auto Populate Contact Us

  1. #1
    ZachJ85 is offline Senior Member
    Join Date
    Apr 2010
    Location
    Philadelphia, PA
    Posts
    99

    Default Auto Populate Contact Us

    I'm attempting to have our contact us page auto populate. When the customer goes to the Contact Us page, currently we have them enter their Name, Phone, Email and Message. To help avoid them typing wrong information, I want to have it auto populate if they already logged in.

    I know the C# code that I need to write to populate this but I was wondering since our Contact Us page is a topic page (www.hostname.com/t-contact.aspx) where is the form in the solution I can go into and edit with?

    Thanks,
    Zach
    SQL 2008, Visual Studio 2010
    Source: C#
    Version: AspDotNetStorefront ML 8.0.1.1/8.0.1.1
    Framework: .Net 4.0 (Running)

  2. #2
    George the Great is offline Senior Member
    Join Date
    Nov 2006
    Location
    Cleveland, OH
    Posts
    1,792

    Default

    In your version the entire form is contained within the topic, so you wouldn't be able to use C# code to auto-populate the values unless you added some code to parse through the topic after it was rendered to the page and make some string replaces. Provided you have the source, an alternative may be to create custom tokens (topics parse skin tokens) that you could use directly within the topic, eg.
    Parser.cs -> BuildPageDynamicTokens()
    Code:
    m_DynamicTokens.Add("(!CONTACTNAME!)", CommonLogic.IIF(ThisCustomer.IsRegistered, ThisCustomer.FullName(), String.Empty));
    m_DynamicTokens.Add("(!CONTACTEMAIL!)", CommonLogic.IIF(ThisCustomer.IsRegistered, ThisCustomer.EMail, String.Empty));
    m_DynamicTokens.Add("(!CONTACTPHONE!)", CommonLogic.IIF(ThisCustomer.IsRegistered, ThisCustomer.Phone, String.Empty));
    Then in the contact topic:
    Code:
    <tr>
        <td valign="top" width="102" align="right">*Your Name:</td>
        <td valign="middle" width="348" align="left"><input name="Name" size="27" id="MailName" value="(!CONTACTNAME!)" type="text"></td>
    </tr>
    <tr>
        <td valign="top" width="102" align="right">*Your Phone:</td>
        <td valign="middle" width="348" align="left"><input name="Phone" size="27" id="MailPhone" type="text" value="(!CONTACTPHONE!)"></td>
    </tr>
    <tr>
        <td valign="top" width="102" align="right">*Your E-Mail:</td>
        <td valign="middle" width="348" align="left"><input name="EMail" size="27" id="MailEmail" type="text" value="(!CONTACTEMAIL!)"></td>
    </tr>
    In versions 9+ the contact us page is an actual page where you could make your modifications to auto-populate the fields.
    <a href="http://www.aspdotnetstorefront.com">Shopping Cart Software</a>