ASP.NET 3.5 and above only

Poll - Templates - Item Templates


Favorite Movie
What is your favorite movie?
  • The Shawshank Redemption
  • The Godfather
  • Star Wars
  • Schindler's List
  • Pulp Fiction
Vote
Show Results
The items of the Poll can be customized using templates. You can embed any content inside an item template, including HTML markup and ASP.NET server controls (any control from the Obout suite may be added to a template).

In order to set up an item template, use the AnswerTemplate property of the Poll. When using item templates, the OnGetSelectedItem and OnSetSelectedItem events should also be employed for getting/setting the selected answer.
ASP.NET
<%@ Register Assembly="Obout.Ajax.UI" Namespace="Obout.Ajax.UI.Poll" TagPrefix="obout" %>
<obout:Poll runat="server" ID="Poll1" DataSourceID="SqlDataSource1"
     Title="Favorite Movie" Question="What is your favorite movie?"
     AllowedVotesPerUser="1" OnGetSelectedItem="Poll1_GetSelectedItem"
     OnSetSelectedItem="Poll1_SetSelectedItem">
    <AnswerTemplate>
        <img src="../resources/images/<%# Container.Item.Text %>.jpg" alt="" height="80" />
        <obout:OboutRadioButton ID="OboutRadioButton2" runat="server" Text='<%# Container.Item.Text %>'
         GroupName="PollItem" />
    </AnswerTemplate>
    <ResultStyle DisplayVotes="true" />
</obout:Poll>
CS
protected void Poll1_GetSelectedItem(object sender, PollAnswerEventArgs e)
{
...
}

protected void Poll1_SetSelectedItem(object sender, PollAnswerEventArgs e)
{
...
}

"I wanted to say this is probably the best set of tools I have ever worked with, but the fact that you guys answer questions is phenomenal. I recommend your stuff to every developer I talk to. "

Karl Wilkens
Multiweb Communications, Inc.

Random testimonial   All testimonials