Link to home
Start Free TrialLog in
Avatar of RecipeDan
RecipeDan

asked on

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

Avatar of Julian Hansen
Julian Hansen
Flag of South Africa image

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
Avatar of RecipeDan
RecipeDan

ASKER

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

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);
ASKER CERTIFIED SOLUTION
Avatar of Julian Hansen
Julian Hansen
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Awesome.Thank you
You are welcome - thanks for the points and good luck with your project.