0

I have added one text box and search button into this application.I want enter a location and click search button then it shows the appropriate location with weather details. I tried in many ways but won't works. So any one have the code, then please share with me. Thank you.

<!DOCTYPE html>

<html>
  <head id="Head1" runat="server">
    <meta charset="utf-8">
    <title>Weather layer</title>


    <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&libraries=weather"></script>
    <script>
        function initialize() {
            var mapOptions = {
                center: new google.maps.LatLng(12.9667, 77.5667),
                zoom: 6,
                mapTypeId: google.maps.MapTypeId.WeatherLayer
            };

            var map = new google.maps.Map(document.getElementById('map-canvas'),
                mapOptions);

            var weatherLayer = new google.maps.weather.WeatherLayer({
                temperatureUnits: google.maps.weather.TemperatureUnit.FAHRENHEIT
            });
            weatherLayer.setMap(map);

            var cloudLayer = new google.maps.weather.CloudLayer();
            cloudLayer.setMap(map);
        }

        google.maps.event.addDomListener(window, 'load', initialize);

    </script>

  </head>
  <body>
      <form id="form1" runat="server">
    <div id="map-canvas"style="height:400px;width:400px;"></div>
  <asp:Button ID="Button1" runat="server" Text="Proceed" />
          <input id="searchTextField" type="text" size="50"style="height:auto;width:320px;">
          </form>
  </body>
</html>

1 Answers1

0

Instead of removing your column, you can hide it by

protected void Button4_Click(object sender, EventArgs e)
{          
   GridView1.Columns[2].Visible = False;
}

However, since its giving you an Index was out of range exception, the third column might not exist in your grid. Seems like you want to hide the second column and so you should write

GridView1.Columns[1].Visible = False;

since the index of grid columns start from zero.

Hitesh
  • 3,449
  • 8
  • 39
  • 57