Click here to Skip to main content
16,007,814 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: Get Loggedin Domain\Username Pin
raesark11-Jun-13 20:20
raesark11-Jun-13 20:20 
GeneralRe: Get Loggedin Domain\Username Pin
jkirkerx12-Jun-13 6:46
professionaljkirkerx12-Jun-13 6:46 
QuestionDrop Down Listnot updating when item deleted from GridView Pin
WickedFooker6-Jun-13 4:59
WickedFooker6-Jun-13 4:59 
AnswerRe: Drop Down Listnot updating when item deleted from GridView Pin
WickedFooker7-Jun-13 3:08
WickedFooker7-Jun-13 3:08 
QuestionGrid View Pin
Kaushik.Subramanian6-Jun-13 3:22
Kaushik.Subramanian6-Jun-13 3:22 
AnswerRe: Grid View Pin
Richard MacCutchan6-Jun-13 4:41
mveRichard MacCutchan6-Jun-13 4:41 
QuestionGrid View Pin
Kaushik.Subramanian5-Jun-13 22:24
Kaushik.Subramanian5-Jun-13 22:24 
QuestionHow do you run the program for downloading financial data from yahoo ? Pin
forte745-Jun-13 15:51
forte745-Jun-13 15:51 
I am running a program which downloads data from yahoo finance. The program has 2 parts. Under Default.aspx I have the following code :

<%@ Page Language="C#" AutoEventWireup="true" 
    CodeBehind="Default.aspx.cs" Inherits="sample._Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Stock quote and chart from Yahoo in C#</title>
<script type="text/javascript" language="JavaScript">
    /// <summary>
    /// This function will be called when user clicks the Get Quotes button.
    /// </summary>
    /// <returns>Always return false.</returns>
    function SendRequest()
    {
        var txtSymbol = document.getElementById("txtSymbol");
        // Refresh the page.
        window.location = "default.aspx?s=" + txtSymbol.value;
        return false;
    }

    /// <summary>
    /// The functyion will be called when a keyboard key is pressed in the textbox.
    /// </summary>
    /// <param name="e">Onkeypress event.</param>
    /// <returns>Return true if user presses Enter key; otherwise false.</returns>
    function CheckEnter(e)
    {
        if ((e.keyCode && e.keyCode == 13) || (e.which && e.which == 13))
            // Enter is pressed in the textbox.
            return SendRequest();
        return true;
    }

    /// <summary>
    /// The function will be called when user
    // changes the chart type to another type.
    /// </summary>
    /// <param name="type">Chart type.</param>
    /// <param name="num">Stock number.</param>
    /// <param name="symbol">Stock symobl.</param>     
    function changeChart(type, num, symbol)
    {
        // All the DIVs are inside the main DIV
        // and defined in the code-behind class.
        var div1d=document.getElementById("div1d_"+num);
        var div5d = document.getElementById("div5d_" + num);
        var div3m = document.getElementById("div3m_" + num);
        var div6m = document.getElementById("div6m_" + num);
        var div1y = document.getElementById("div1y_" + num);
        var div2y = document.getElementById("div2y_" + num);
        var div5y = document.getElementById("div5y_" + num);
        var divMax = document.getElementById("divMax_" + num);
        var divChart = document.getElementById("imgChart_" + num);
        // Set innerHTML property.
        div1d.innerHTML = "1d";
        div5d.innerHTML="5d";
        div3m.innerHTML="3m";
        div6m.innerHTML="6m";
        div1y.innerHTML="1y";
        div2y.innerHTML="2y";
        div5y.innerHTML="5y";
        divMax.innerHTML="Max";
        // Use a random number to defeat cache.
        var rand_no = Math.random();
        rand_no = rand_no * 100000000;
        //  Display the stock chart.
        switch(type)
        {
        case 1: // 5 days
            div5d.innerHTML="5d";
            divChart.src = "http://ichart.finance.yahoo.com/w?s=" + 
                           symbol + "&" + rand_no;
            break;
        case 2: // 3 months
            div3m.innerHTML="3m";
            divChart.src = "http://chart.finance.yahoo.com/c/3m/" + 
                           symbol + "?" + rand_no;
            break;
        case 3: // 6 months 
            div6m.innerHTML = "6m";
            divChart.src = "http://chart.finance.yahoo.com/c/6m/" + 
                           symbol + "?" + rand_no;
            break;
        case 4: // 1 year
            div1y.innerHTML = "1y";
            divChart.src = "http://chart.finance.yahoo.com/c/1y/" + 
                           symbol + "?" + rand_no;
            break;
        case 5: // 2 years
            div2y.innerHTML = "2y";
            divChart.src = "http://chart.finance.yahoo.com/c/2y/" + 
                           symbol + "?" + rand_no;
            break;
        case 6: // 5 years
            div5y.innerHTML = "5y";
            divChart.src = "http://chart.finance.yahoo.com/c/5y/" + 
                           symbol + "?" + rand_no;
            break;
        case 7: // Max
            divMax.innerHTML = "msx";
            divChart.src = "http://chart.finance.yahoo.com/c/my/" + 
                           symbol + "?" + rand_no;
            break;
        case 0: // 1 day
        default:                
            div1d.innerHTML = "1d";
            divChart.src = "http://ichart.finance.yahoo.com/b?s=" + 
                           symbol + "&" + rand_no;
            break;
        }
    }
</script>    

</head>
<body>
    <form id="form1" runat="server">
    <div>
        <table width="100%" border="0" 
                 cellspacing="0" cellpadding="0">
            <tr valign="top">                                            
                <td style="font-family: Arial, Helvetica, sans-serif; 
                           font-size: 14px; color: #000; text-decoration: none;">
                    <input type="text" value="" id="txtSymbol" 
                        runat="server" onkeypress="return CheckEnter(event);" />
                    <input type="button" value="Get Quotes" 
                        onclick="return SendRequest();" />
                    <br />
                    <span style="font-family: Arial, Helvetica, sans-serif; 
                                 font-size: 11px; color: #666;">
                        e.g. "YHOO or YHOO GOOG"
                    </span>
                    <%if (m_symbol != "") {%>                        
                        <div id="divService" runat="server">
                        <!-- Main DIV: this DIV contains text and DIVs 
                                       that displays stock quotes and chart. -->
                        </div>
                    <%}%>
                </td>    
            </tr>
        </table>
    </div>
    </form>
</body>
</html>

And under Default.aspx page I have the following code:
<%@ Page Language="C#" AutoEventWireup="true" 
    CodeBehind="Default.aspx.cs" Inherits="sample._Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Stock quote and chart from Yahoo in C#</title>
<script type="text/javascript" language="JavaScript">
    /// <summary>
    /// This function will be called when user clicks the Get Quotes button.
    /// </summary>
    /// <returns>Always return false.</returns>
    function SendRequest()
    {
        var txtSymbol = document.getElementById("txtSymbol");
        // Refresh the page.
        window.location = "default.aspx?s=" + txtSymbol.value;
        return false;
    }

    /// <summary>
    /// The functyion will be called when a keyboard key is pressed in the textbox.
    /// </summary>
    /// <param name="e">Onkeypress event.</param>
    /// <returns>Return true if user presses Enter key; otherwise false.</returns>
    function CheckEnter(e)
    {
        if ((e.keyCode && e.keyCode == 13) || (e.which && e.which == 13))
            // Enter is pressed in the textbox.
            return SendRequest();
        return true;
    }

    /// <summary>
    /// The function will be called when user
    // changes the chart type to another type.
    /// </summary>
    /// <param name="type">Chart type.</param>
    /// <param name="num">Stock number.</param>
    /// <param name="symbol">Stock symobl.</param>     
    function changeChart(type, num, symbol)
    {
        // All the DIVs are inside the main DIV
        // and defined in the code-behind class.
        var div1d=document.getElementById("div1d_"+num);
        var div5d = document.getElementById("div5d_" + num);
        var div3m = document.getElementById("div3m_" + num);
        var div6m = document.getElementById("div6m_" + num);
        var div1y = document.getElementById("div1y_" + num);
        var div2y = document.getElementById("div2y_" + num);
        var div5y = document.getElementById("div5y_" + num);
        var divMax = document.getElementById("divMax_" + num);
        var divChart = document.getElementById("imgChart_" + num);
        // Set innerHTML property.
        div1d.innerHTML = "1d";
        div5d.innerHTML="5d";
        div3m.innerHTML="3m";
        div6m.innerHTML="6m";
        div1y.innerHTML="1y";
        div2y.innerHTML="2y";
        div5y.innerHTML="5y";
        divMax.innerHTML="Max";
        // Use a random number to defeat cache.
        var rand_no = Math.random();
        rand_no = rand_no * 100000000;
        //  Display the stock chart.
        switch(type)
        {
        case 1: // 5 days
            div5d.innerHTML="5d";
            divChart.src = "http://ichart.finance.yahoo.com/w?s=" + 
                           symbol + "&" + rand_no;
            break;
        case 2: // 3 months
            div3m.innerHTML="3m";
            divChart.src = "http://chart.finance.yahoo.com/c/3m/" + 
                           symbol + "?" + rand_no;
            break;
        case 3: // 6 months 
            div6m.innerHTML = "6m";
            divChart.src = "http://chart.finance.yahoo.com/c/6m/" + 
                           symbol + "?" + rand_no;
            break;
        case 4: // 1 year
            div1y.innerHTML = "1y";
            divChart.src = "http://chart.finance.yahoo.com/c/1y/" + 
                           symbol + "?" + rand_no;
            break;
        case 5: // 2 years
            div2y.innerHTML = "2y";
            divChart.src = "http://chart.finance.yahoo.com/c/2y/" + 
                           symbol + "?" + rand_no;
            break;
        case 6: // 5 years
            div5y.innerHTML = "5y";
            divChart.src = "http://chart.finance.yahoo.com/c/5y/" + 
                           symbol + "?" + rand_no;
            break;
        case 7: // Max
            divMax.innerHTML = "msx";
            divChart.src = "http://chart.finance.yahoo.com/c/my/" + 
                           symbol + "?" + rand_no;
            break;
        case 0: // 1 day
        default:                
            div1d.innerHTML = "1d";
            divChart.src = "http://ichart.finance.yahoo.com/b?s=" + 
                           symbol + "&" + rand_no;
            break;
        }
    }
</script>    

</head>
<body>
    <form id="form1" runat="server">
    <div>
        <table width="100%" border="0" 
                 cellspacing="0" cellpadding="0">
            <tr valign="top">                                            
                <td style="font-family: Arial, Helvetica, sans-serif; 
                           font-size: 14px; color: #000; text-decoration: none;">
                    <input type="text" value="" id="txtSymbol" 
                        runat="server" onkeypress="return CheckEnter(event);" />
                    <input type="button" value="Get Quotes" 
                        onclick="return SendRequest();" />
                    <br />
                    <span style="font-family: Arial, Helvetica, sans-serif; 
                                 font-size: 11px; color: #666;">
                        e.g. "YHOO or YHOO GOOG"
                    </span>
                    <%if (m_symbol != "") {%>                        
                        <div id="divService" runat="server">
                        <!-- Main DIV: this DIV contains text and DIVs 
                                       that displays stock quotes and chart. -->
                        </div>
                    <%}%>
                </td>    
            </tr>
        </table>
    </div>
    </form>
</body>
</html>


When I run the program , I get the bundles elements is not declared and txtSymbol and divService does not exist in the current context.
QuestionAdd Live TV in Asp.Net Pin
Jak Anil4-Jun-13 2:10
Jak Anil4-Jun-13 2:10 
AnswerRe: Add Live TV in Asp.Net Pin
Chetan Talwar6-Jun-13 17:17
Chetan Talwar6-Jun-13 17:17 
GeneralRe: Add Live TV in Asp.Net Pin
Jak Anil7-Jun-13 1:56
Jak Anil7-Jun-13 1:56 
QuestionValidationExpression complexity Pin
VikramKumarJ4-Jun-13 1:53
VikramKumarJ4-Jun-13 1:53 
AnswerRe: ValidationExpression complexity Pin
Richard Deeming4-Jun-13 1:58
mveRichard Deeming4-Jun-13 1:58 
GeneralRe: ValidationExpression complexity Pin
VikramKumarJ4-Jun-13 18:23
VikramKumarJ4-Jun-13 18:23 
QuestionBackend Image creation and loading in webpage Pin
bigjfunk3-Jun-13 17:18
bigjfunk3-Jun-13 17:18 
AnswerRe: Backend Image creation and loading in webpage Pin
Bernhard Hiller3-Jun-13 21:26
Bernhard Hiller3-Jun-13 21:26 
AnswerRe: Backend Image creation and loading in webpage Pin
Jasmine25015-Jun-13 12:34
Jasmine25015-Jun-13 12:34 
QuestionMini-registration Check if Room is booked or open Pin
WickedFooker2-Jun-13 11:11
WickedFooker2-Jun-13 11:11 
AnswerRe: Mini-registration Check if Room is booked or open Pin
Bernard Grosperrin8-Jun-13 1:30
Bernard Grosperrin8-Jun-13 1:30 
QuestionLooking for ideas for custom WYSIWYG editor for LED display Pin
Member 1008696031-May-13 10:15
Member 1008696031-May-13 10:15 
AnswerRe: Looking for ideas for custom WYSIWYG editor for LED display Pin
Jasmine25015-Jun-13 12:30
Jasmine25015-Jun-13 12:30 
QuestionWhat is the difference between DBContext class and ObjectContext ? Pin
Rockstar_30-May-13 23:29
professionalRockstar_30-May-13 23:29 
AnswerRe: What is the difference between DBContext class and ObjectContext ? Pin
Richard MacCutchan31-May-13 10:42
mveRichard MacCutchan31-May-13 10:42 
QuestionDispaly picture news widh rss reader Pin
mehdin6930-May-13 22:43
mehdin6930-May-13 22:43 
AnswerRe: Dispaly picture news widh rss reader Pin
mehdin6931-May-13 10:09
mehdin6931-May-13 10:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.