Hi folks,
Well, judicious use of Google failed to turn up an answer to this, and you guys are always fast to reply, so here goes again.
My little ASP.NET application involves a simple (well, for you) voting engine. My page displays a suggestion pulled at random from my database, along with a set of radio buttons with numbers. Users will vote on each suggestion by clicking on the radio buttons. My radio buttons look like this:
I want this form to work so that as soon as a user clicks on a radio button, their vote is immediately submitted. (One-click voting, instead of selecting a button and then clicking on Submit.) As soon as the vote is recorded, the page will be refreshed with a new suggestion displayed.
Pretty much like this site:
I haven't been able to figure out how to make this happen without requiring the user to select a radio button and then click on a Submit button of some kind. I suspect this somehow will involve the whole "AutoPostBack="True"" concept? I also know that Buttons have an OnClick event, but haven't been able to figure out how to call the code that would submit the vote to the database.
Thoughts? Feedback always appreciated.
Steve
Well, judicious use of Google failed to turn up an answer to this, and you guys are always fast to reply, so here goes again.
My little ASP.NET application involves a simple (well, for you) voting engine. My page displays a suggestion pulled at random from my database, along with a set of radio buttons with numbers. Users will vote on each suggestion by clicking on the radio buttons. My radio buttons look like this:
Code:
<asp:RadioButtonList ID="VoteList" runat="server" RepeatDirection="Horizontal" AutoPostBack="True" BackColor="#E0E0E0" BorderColor="#404040" BorderStyle="Solid" BorderWidth="2px">
<asp:ListItem Value="1">1</asp:ListItem>
<asp:ListItem Value="2">2</asp:ListItem>
<asp:ListItem Value="3">3</asp:ListItem>
<asp:ListItem Value="4">4</asp:ListItem>
<asp:ListItem Value="5">5</asp:ListItem>
<asp:ListItem Value="6">6</asp:ListItem>
<asp:ListItem Value="7">7</asp:ListItem>
<asp:ListItem Value="8">8</asp:ListItem>
<asp:ListItem Value="9">9</asp:ListItem>
<asp:ListItem Value="10">10</asp:ListItem>
</asp:RadioButtonList>
I want this form to work so that as soon as a user clicks on a radio button, their vote is immediately submitted. (One-click voting, instead of selecting a button and then clicking on Submit.) As soon as the vote is recorded, the page will be refreshed with a new suggestion displayed.
Pretty much like this site:
I haven't been able to figure out how to make this happen without requiring the user to select a radio button and then click on a Submit button of some kind. I suspect this somehow will involve the whole "AutoPostBack="True"" concept? I also know that Buttons have an OnClick event, but haven't been able to figure out how to call the code that would submit the vote to the database.
Thoughts? Feedback always appreciated.
Steve