Asp.Net?

Mar 8, 2011 at 10:01 PM

Forgive me if this is obvious, but how can I get the Value of the Div and send it to my asp.Net Function so it can be saved in a DB?

Coordinator
Mar 9, 2011 at 2:25 PM

I guess you are using ASP.NET WebForms.

The easiest way is to create a hidden field and bind it to the rating plugin:

   <asp:HiddenField ID="RateIt" runat="server" />
        <div class="rateit" data-rateit-backingfld="#<%= RateIt.ClientID %>"></div>

 

Now whenever the rating changes, it will update the HiddenField control.

 


 

 

In your code behind:

    protected void RateIt_ValueChanged(object sender, EventArgs e)
    {
        Response.Write("NEW VALUE:" + RateIt.Value);
    }

On your page:
        <asp:HiddenField ID="RateIt" runat="server"  onvaluechanged="RateIt_ValueChanged"   />
        <div class="rateit" data-rateit-backingfld="#<%= RateIt.ClientID %>"></div>
Extra javascript:
    <script>
        $('.rateit').bind('rated'function () { $(this).closest('form').submit(); })
    </script>