Click here to Skip to main content
15,887,344 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am writing the below code to pass inputs to NDFDgen() function by passing inputs through the textboxes.


My ASP page has 2 textboxes for latitude and longitude, submit button and a label.

I am getting "Point is not on an NDFD grid" exception as the method is getting called even before submit button is invoked.
Could anyone please help me with this.

What I have tried:

C#
    protected void Page_Load(object sender, EventArgs e)
    {

        decimal lat = String.IsNullOrEmpty(TextBox1.Text) ? 0 : decimal.Parse(TextBox1.Text);
        decimal lng = String.IsNullOrEmpty(TextBox1.Text) ? 0 : decimal.Parse(TextBox2.Text);

        //decimal lat = 42.3086M;
         //decimal lng = -83.4822M;
         

        Weather_Check.weatherParametersType wtp = new Weather_Check.weatherParametersType();
        wtp.temp = true;
        wtp.snow = true;
        Weather_Check.ndfdXML myobject = new Weather_Check.ndfdXML();

        string xml = myobject.NDFDgen(lat, lng, Weather_Check.productType.timeseries, DateTime.Now, DateTime.Now, Weather_Check.unitType.e, wtp);
        if (string.IsNullOrEmpty(xml) == false)
        {
            xml = xml.Substring(xml.IndexOf("Temperature"));
            Label1.Text = xml;
        }
 
    }
}
Posted

1 solution

Sorry I discovered the solution, we have to embed the code in button1_Click() function and works fine
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900