1
<asp:Content ID="Content1" ContentPlaceHolderID="Head" runat="Server">  
 <script type="text/javascript">
  $(function () {
                $("#slider-range").slider({
                    range: true,
                    min: 0,
                    max: 100,
                    values: [0, 75],
                    slide: function (event, ui) {
                        $("#value").val("" + ui.values[0] + " - " + ui.values[1]);
                    }
                });
                $("#value").val("" + $("#slider-range").slider("values", 0) +
                " - " + $("#slider-range").slider("values", 1));
            });
  </script>
</asp:content>

I am using this code for a slider in my asp.net page. Now the value in displayed in the Html input.

  <input type="text" id="value" style="border: 0; font-weight: bold;" />

it is displayed as 0-75. How can I get both the values (0,75) separately in my server side so that i can write the values in database.

2 Answers 2

1

Not sure there is enough information here, but making a bunch of assumptions.

<input type="text" id="value" name="value" style="border: 0; font-weight: bold;" />

Then when you submit your page:

Request.Form["value"] (OR Request.QueryString["value"] in some cases) 

... will contain your value.

string[] values;
string value = Request.Form["value"];
if ( !String.IsNullOrEmpty( value ) )
{
    values = value.Split( '-' );
}
Sign up to request clarification or add additional context in comments.

1 Comment

I am using a master page, how to get values from there.
1

Assuming you have a form element, these value would be available in the form collection and in the button click event you can check Request.Form["value"].ToString() and should be able to get the value as 0-75 which you can then split

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.