MonoX support board

Start the conversation, ask questions and share tips and solutions with fellow developers.

Non-registered users can only browse through our support boards. Please register now if you want to post your questions. It takes a second and it is completely free. Alternatively, you can log in without registration using your credentials at major sites such as Google, Microsoft Live, OpenId, Facebook, LinkedIn or Yahoo.

Polls: How to configure polls and Apply CSS like on Page 66 of Documentation (Closed) (Mono Support )

Viewed 71513 time(s), 28 post(s) 7/15/2011 12:24:25 AMby yousaid

Related topics

yousaid

yousaid

7/15/2011 3:05:53 AM
The steps described here don't seem to work anymore:. Getting same behavior on both Firefox and IE on 4 different machines.
http://www.mono-software.com/Mono/Pages/Discussion/dtopic/kbPdqG_KJU2e4J6KATl6gQ/How-do-you-create-a-poll-or-instantiate-any-of-the-included-modules/

Step 1:
Login as Admin
I go the Portal administration area.
Step 2:
I Click on Polls
Step 3:
I create a Poll and add Poll answers. Create another Poll with answers. So I now have poll #1 and Poll #2
Step 4
I select Web Part Catalog and select Polls [ModuleGallery]
Step 5:
For Add to: I choose, Right Part zone and click add. (could also be added to any Part Zone)
Poll appears on the Right zone as selected.Issues:

ISSUES:
(a) Niether the poll questions nor the answers are displayed. No Vote Button or any way for users to make a choice and vote is shown. Only the webpart Title of "Polls" is shown.
(b) No way to select either Poll #1 or Poll #2 as the Poll to display.

(c) On the page, there is a "Web part menu" that includes Properties, Copy, Minimize, Close, Delete.
However, when you click on the properties, Nothing happens. (the page just refreshes) I guess the properties is where you set the Poll you want displayed, the Css styling etc

QUESTION:
Where did I go wrong?
How do I get it to display like the sample shown on Page 66 of the documentation under "portal administration"
Could this be a caching issue? If yes, how to resolve?

cheers,
yousaid
This content has not been rated yet. 
206 Reputation 36 Total posts
khorvat

khorvat

7/15/2011 8:23:00 AM
Hi,

  you didn't do anything wrong, I guess you have missed the last step while configuring the Poll. You need to go to properties as you did and then click on the administration toolbar, click on the Web part properties tab and scroll down to the Poll name.

You can follow the attached screenshots.
Rated 5.00, 1 vote(s). 
15993 Reputation 2214 Total posts
yousaid

yousaid

7/16/2011 8:46:32 PM
Greetings,
Although I have the poll working fine, the Vote button is displayed as "Link" and not as a Button. In the configuration properties, I set CSS class to poll, but it does not seem to be applied. (I have tried it with and without the CSS property defined, but same results)

Do I have to write my own Poll CSS class for Poll styling or did I miss something?
Is there anyway you can share the CSS that was used for the styling of the Poll shown in the demo or similar CSS.
cheers,
yousaid
This content has not been rated yet. 
206 Reputation 36 Total posts
khorvat

khorvat

7/17/2011 8:08:46 AM
Hi,

Vote buttons are originally link buttons without styling so if you want to change the styling of those buttons you can add something like this to you css inside your theme:

.poll A
{
  /* your css style */
}

Here is a small link button css that you can use or change

.poll A
{
        background-color: #F2F7FC;
    border: 1px solid #CBD3D9;
    display: inline-block;
    padding: 5px 10px;
    color: #a5b2bd;
    font-size: 12px;
    font-weight: bold;
    font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif;
}
 
.poll A:hover
{
        background-color: #CBD3D9;
    border: 1px solid #CBD3D9;
    text-decoration: none;
    color: #142738;
}

I you want to get the button to look even nicer let us know and we will provide you with steps how to do that.

Regards

Rated 5.00, 1 vote(s). 
15993 Reputation 2214 Total posts
yousaid

yousaid

7/17/2011 8:12:14 PM
Thanks for your reply.
YES, I would like to know how to get it to look even better. Please provide the steps.
(b) I will also recommend for the benefit of others that you change this link on your website:

http://www.mono-software.com/Mono/Pages/Discussion/dtopic/kbPdqG_KJU2e4J6KATl6gQ/How-do-you-create-a-poll-or-instantiate-any-of-the-included-modules/

to point to this:

http://www.mono-software.com/Mono/Pages/Discussion/dtopic/PAngXB00cEeWO58hABZxmQ/Polls-How-to-configure-polls-and-Apply-CSS-like-on-Page-66-of-Documentation/

The later is more indept and more helpful.
cheers,
yousaid
This content has not been rated yet. 
206 Reputation 36 Total posts
khorvat

khorvat

7/18/2011 8:35:30 AM
Hi,

we will try to update our documentation (MonoX manual) and add a small article related to Poll management, after that we will update the Home page links.

Thanks for pointing us to the outdated link.


BTW: Ivan will provide you with the steps soon
This content has not been rated yet. 
15993 Reputation 2214 Total posts
imarusic

imarusic

7/18/2011 9:38:01 AM
Hi,

to replace the linkbuttons with buttons please follow the steps below:

1. Add a new user control with code behind which need to extend the MonoX Poll Module:

public partial class PollModuleTEST : MonoSoftware.MonoX.ModuleGallery.MonoXPollModule

2. Override OnPreRender(EventArgs e) method:

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;
}


3. Copy markup code from MonoX Poll module to your new one and make some changes as shown below:

<%@ Control Language="C#"
  AutoEventWireup="true"
  CodeBehind="PollModuleTEST.ascx.cs"
  Inherits="MonoSoftware.MonoX.ModuleGallery.PollModuleTEST"
 
%>
  
<%@ Register TagPrefix="MonoX" TagName="StyledButton" Src="/MonoX/controls/StyledButton.ascx" %>


<div style="margin-top: 10px;">
           <asp:PlaceHolder ID="plhLinkButtons" runat="server">
               <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="btnResult1" runat="server" OnClick="btnResults_Click" />
</div>

4. Add an additional button that will replace the btnShowVotePanel linkbutton:

<asp:LinkButton runat="server" ID="btnShowVotePanel" OnClick="btnShowVotePanel_Click" /> 
<MonoX:StyledButton ID="btnShowVotePanel1" runat="server" OnClick="btnShowVotePanel_Click" />


Regards.
This content has not been rated yet. 
3016 Reputation 428 Total posts
yousaid

yousaid

7/19/2011 1:36:50 AM
Greetings,
Following your directions, I came up with this code, BUT it will NOT compile.
Where did I go wrong?

cheers,
yousaid

CodeBehind
-------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Pollcontrol : MonoSoftware.MonoX.ModuleGallery.MonoXPollModule
{

protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);

plhLinkButtons.Visible = false;

btnShowVotePanel.Visible = false;



btnVote.Text = this.VoteButtonText;

btnResults.Text = this.ResultsButtonText;

btnShowVotePanel.Text = this.VoteButtonText;


}
}
------------------------------------------------------------------------------

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Pollcontrol.ascx.cs" Inherits="MonoSoftware.MonoX.ModuleGallery.Pollcontrol" %>
<%@ 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:LinkButton runat="server" ID="btnVote" OnClick="btnVote_Click" /> |
<asp:LinkButton runat="server" ID="btnResults" 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:PlaceHolder ID="plhLinkButtons" runat="server">

<asp:LinkButton runat="server" ID="LinkButton1" OnClick="btnVote_Click" /> |

<asp:LinkButton runat="server" ID="LinkButton2" OnClick="btnResults_Click" />

</asp:PlaceHolder>

<MonoX:StyledButton ID="btnVote1" runat="server" OnClick="btnVote_Click" />

<MonoX:StyledButton ID="btnResult1" runat="server" OnClick="btnResults_Click" />
<asp:LinkButton runat="server" ID="btnShowVotePanel" OnClick="btnShowVotePanel_Click" />
<asp:LinkButton runat="server" ID="LinkButton3" OnClick="btnShowVotePanel_Click" />

<MonoX:StyledButton ID="btnShowVotePanel1" runat="server" OnClick="btnShowVotePanel_Click" />
</asp:Panel>
</div>
</asp:Panel>

This content has not been rated yet. 
206 Reputation 36 Total posts
khorvat

khorvat

7/19/2011 6:14:21 AM
Hi,

there may be a few things that you have missed. Please check if your designer file has created all of the mark-up controls, if so you need to delete all the controls except the ones newly added. Also please change the names of the "LinkButton1-3" they are probably throwing exceptions (you didn't provide us with exception you get), buttons should have names as Ivan has shown in his code preview:

<asp:PlaceHolder ID="plhLinkButtons" runat="server">
    <asp:LinkButton runat="server" ID="btnVote" OnClick="btnVote_Click" /> |
    <asp:LinkButton runat="server" ID="btnResults" OnClick="btnResults_Click" />
</asp:PlaceHolder>

Regards
This content has not been rated yet. 
15993 Reputation 2214 Total posts
imarusic

imarusic

7/19/2011 8:05:53 AM
Hi,

your markup and code behind should look like the example below:

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>



PS: can you please follow the steps in attached images in case when you post a code example to our support. It is much easier to read the code that way.


Regards.
This content has not been rated yet. 
3016 Reputation 428 Total posts
1 2 3