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
Solved

A c# function return undefined (ASP.NET C#)

Posted on 2003-11-28
3
806 Views
Last Modified: 2010-08-05
Hello,
This one should be easy...

Still learning C# I am stuck with that...

I have a function getQuote(string SYMB) in my aspx.cs file at this point for debugging, getWuote return SYMB:

Her is the cs file:

---------------------

namespace StockQuote
{
      /// <summary>
      /// Summary description for WebForm1.
      /// </summary>
      public class WebForm1 : System.Web.UI.Page
      {

            private void Page_Load(object sender, System.EventArgs e)
            {
                  // Put user code to initialize the page here



            }
            
      
            #region Web Form Designer generated code
            override protected void OnInit(EventArgs e)
            {
                  //
                  // CODEGEN: This call is required by the ASP.NET Web Form Designer.
                  //
                  InitializeComponent();
                  base.OnInit(e);
            }
            
            /// <summary>
            /// Required method for Designer support - do not modify
            /// the contents of this method with the code editor.
            /// </summary>
            private void InitializeComponent()
            {    
                  this.Load += new System.EventHandler(this.Page_Load);

            }
            #endregion
      
            public string getQuote(string SYMB)
         {
                  return SYMB;
            }
      }
}
---------------------
Here is part of the form aspx:
I want a funsction to return a string in my javascript section.  It currently return "undefined"
What going on?

...
<script language="JavaScript">
...
myScroller1.addItem(<%getQuote("molb.to");%>);
...
      </script>
      </form>
0
Comment
3 Comments
 
LVL 1

Expert Comment

by:AJMartin
ID: 9840100
I think that this line:

 myScroller1.addItem(<%getQuote("molb.to");%>);

should be like:

 myScroller1.addItem(<%WebForm1.getQuote("molb.to");%>);

I hope that helps!
0
 
LVL 18

Accepted Solution

by:
testn earned 50 total points
ID: 9844248
it should be


myScroller1.addItem(<%=getQuote("molb.to")%>);
0
 

Author Comment

by:Yann de Champlain, PMP
ID: 9850414
WebForm1.getQuote("molb.to"); is not working. but myScroller1.addItem(<%=getQuote("molb.to")%>); is!.

I tried (<%=getQuote("molb.to")%> but with a ";" after the method.  I don't know why we don't need a ; after the line.

Thanks a lot for your answer!
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SqlDataBase 7 53
compare between entities in entity framework 8 94
Getting error in connectionstring with Excel. 30 45
tableview is not updating 1 20
Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

838 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