1. Code behind
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace MonoSoftware.MonoX.ModuleGallery
{
public partial class PollModuleTEST : MonoSoftware.MonoX.ModuleGallery.MonoXPollModule
{
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
plhLinkButtons.Visible = false;
btnShowVotePanel.Visible = false;
btnVote1.Text = this.VoteButtonText;
btnResults1.Text = this.ResultsButtonText;
btnShowVotePanel1.Text = this.VoteButtonText;
}
}
}
2. Markup:
<%@ Control Language="C#"
AutoEventWireup="true"
CodeBehind="PollModuleTEST.ascx.cs"
Inherits="MonoSoftware.MonoX.ModuleGallery.PollModuleTEST"
%>
<%@ Register TagPrefix="MonoX" TagName="StyledButton" Src="/MonoX/controls/StyledButton.ascx" %>
<asp:Panel runat="server" ID="pnlContainer">
<div class="poll">
<div class="poll-question"><asp:Label runat="server" ID="lblQuestion"></asp:Label></div>
<asp:Panel runat="server" ID="pnlInput">
<asp:RadioButtonList runat="server" ID="rblAnswers">
</asp:RadioButtonList>
<div style="margin-top: 10px;">
<asp:PlaceHolder ID="plhLinkButtons" runat="server" Visible="false">
<asp:LinkButton runat="server" ID="btnVote" OnClick="btnVote_Click" /> |
<asp:LinkButton runat="server" ID="btnResults" OnClick="btnResults_Click" />
</asp:PlaceHolder>
<MonoX:StyledButton ID="btnVote1" runat="server" OnClick="btnVote_Click" />
<MonoX:StyledButton ID="btnResults1" runat="server" OnClick="btnResults_Click" />
</div>
</asp:Panel>
<asp:Panel runat="server" ID="pnlGraph" Width="100%">
<asp:Repeater runat="server" ID="rptGraph">
<ItemTemplate>
<asp:Label runat="server" ID="lblAnswer" Text='<%# GetAnswerText(Eval("Answer").ToString(), int.Parse(Eval("Votes").ToString())) %>'></asp:Label><br />
<asp:Panel runat="server" ID="pnlWidth" BackColor='<%# GetColor(Eval("Color").ToString()) %>' Width='<%# GetWidth(Eval("Votes").ToString()) %>' Height="15px" CssClass='<%# GetColor(Eval("Color").ToString()).Equals(System.Drawing.Color.Empty) ? "poll-bg-color" : String.Empty %>'></asp:Panel>
</ItemTemplate>
<SeparatorTemplate>
<div class="separator">
</div>
</SeparatorTemplate>
</asp:Repeater>
<div style="margin-top: 10px; font-weight: bold;"><asp:Label runat="server" ID="lblTotal"></asp:Label></div>
<asp:LinkButton runat="server" ID="btnShowVotePanel" OnClick="btnShowVotePanel_Click" />
<MonoX:StyledButton ID="btnShowVotePanel1" runat="server" OnClick="btnShowVotePanel_Click" />
</asp:Panel>
</div>
</asp:Panel>