Search code examples
c#jqueryfarbtastic

Get custom Value of Jquery into C# .net


I'm using farbtastic color picker in a .net project, I need to get the selected color from the plugin in the C# page. The right way to Get the value in jquery is:

$.farbtastic('#colorpicker').color

thats return the value I need. the question is: How can I get this value in my C# page:


Solution

  • you can do something like this :

    css:

    .txt{display:none;}
    

    jQuery:

    $('.txt').val($.farbtastic('#colorpicker').color);
    

    asp:

    <asp:TextBox ID="txt" CssClass="txt" runat="server"></asp:TextBox>
    

    C#:

    color = txt.Text;