?
Solved

calling ASP.net  function from javascript

Posted on 2003-03-07
1
Medium Priority
?
316 Views
Last Modified: 2012-05-04
I'm getting the time limit from the database and then start counting down the clock.

This is my code under script tag inside aspx file

var CDTimer1 = new CountDownTimer(<%# getTimeLimit() %>);

As you can see i have put the function getTimeLimit() that returns an integer , e.g 35.

Here is the function in aspx.vb file
Function getTimelimit() As Integer
        Dim drtimeLimit As SqlDataReader
        Dim gValue As clsGetValues

' this here would get the value from the database and keep in the datareader object
        drtimeLimit = gValue.SP_DataReader("sp_TimeLimit", "@ActivityID", "25")
        If drtimeLimit.Read() Then
            Dim temp As String = drtimeLimit("TimeLimit")
            Dim value As Integer
            value = CInt(temp)
            getTimelimit = value
        Else
            drtimeLimit.Close()
            drtimeLimit = Nothing
            getTimelimit = 0
        End If
    End Function

It compiled successfully but doesn't do the needed work. Somehow CDTimer1 variable is set to 0. I don't understand why. I also want to know what is the different between <%# and <%= tag and when to use them


Thanks
0
Comment
Question by:der_23
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 5

Accepted Solution

by:
Koma666 earned 900 total points
ID: 8087101
<%= is the same like response.write

try to set your timelimit to 10 in your

else

if the CDTimer1 then is set to 10 then the problem is that
drtimeLimit.Read() = false

i don´t know much about asp.net only asp but have a closer look at the read function, perhaps read needs a parameter.
0

Featured Post

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question