Ajax Toolkit to JQuery

I have been trying to convert scripts that I have in AJax Toolkit to JQuery. How to I get the spinner to read values from a database? Below is how I set it up the NumericUpDownExtender in Toolkit but I am at a loss on how to use spinner to read values from a database

        public void TimeList()
        {
            SqlConnection conn;
            SqlCommand comm;
            SqlDataReader reader;
            string connectionString = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString;
            conn = new SqlConnection(connectionString);
            comm = new SqlCommand("SELECT FollowupTime FROM S_Setup", conn);
            try
            {
                conn.Open();
                reader = comm.ExecuteReader();
                if (reader.Read())
                {
                    string Followup = reader["FollowupTime"].ToString();
                    NumericUpDownExtender1.Minimum = Convert.ToDouble(Followup);
                    NumericUpDownExtender1.Step = Convert.ToDouble(Followup);
                }    
                reader.Close();
            }
            finally
            {
                conn.Close();
            }
        }

Open in new window

LVL 1
RecipeDanAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Julian HansenCommented:
This question has moved into the neglected category - so will attempt to help but not familiar with the .Net tech you are using.

You might need to post some more code.

Show us where you are trying to make the AJAX call

The code you have posted does not seem to return anything that would be useful to an AJAX call
0
RecipeDanAuthor Commented:
Hello:

Why was it moved to the neglected category? I only asked the question last night. Maybe I was not clear.

I am converting AJAX Toolkit Scripts to JQuery. One of the scripts that I am converting is the AJax Toolkit NumericUpDownExtender. The way my script is now, the NumericUpDownExtender is dynamic and reads values from a database. So what I want to do is use the JQuery Spinner instead of the AJAX Toolkit NumericUpDownExtender.

What I do not know how to do is get the values from a database and put them in the JQuery Spinner Code so that the Step Value and Spinner value are dynamic based on user input. Below is my JQuery Spinner Code

  <script>
  $(function() {
    var spinner = $( "#spinner" ).spinner();
     $( "#spinner" ).spinner({
      step: 5,
      numberFormat: "n"
    });

    $( "#setvalue" ).click(function() {
      spinner.spinner( "value", 15 );
    });
  });
  </script>

Open in new window

0
Pravin AsarPrincipal Systems EngineerCommented:
Look at create or start event for Spinner.

http://api.jqueryui.com/spinner/

Perform, ajax call to server
Assign the returned result to set min and max limits
e.g.

$('#spinId').spinner('option', 'min', data.min);
$('#spinId').spinner('option', 'max', data.max);
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Julian HansenCommented:
@recipedan
Why was it moved to the neglected category? I only asked the question last night
This is an automatic process that kicks in if a question does not receive any responses within a certain time period - it is meant as nudge for experts to come and take a look.

In terms of what you want to do there are several options. If you are rendering out the Javascript as part of your page render you can simply put the retrieved values into the JQuery code with <%=DB.Value%>

Failing that you can output var statements from your code
var step=<%=stepValue%>;
var initialValue = <%=initialValue%>;

You can then modify your code to use these variables.

A third option is to embed values into your #spinner element as HTML5 data elements
[code]<input id="spinner" type="text" data-step="5" data-value="15" />

Open in new window

And then use JQuery like this.
  <script>
  $(function() {
  
    var spinner = $( "#spinner" ).spinner();
     $( "#spinner" ).spinner({
      step: $('#spinner').data('step'),
      numberFormat: "n"
    });

    $( "#setvalue" ).click(function() {
      spinner.spinner( "value", $('#spinner').data('value') );
    });
  });
  </script>

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
RecipeDanAuthor Commented:
Awesome.Thank you
0
Julian HansenCommented:
You are welcome - thanks for the points and good luck with your project.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
jQuery

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.