Friday, 5 July 2013

add multple locations in google map using asp.net c#.net/ vb.net

here shows multiple locations adding in google map using java script / jquery in Asp.net, c#.net, vb.net

<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
    <script type="text/javascript">
    var markers = [
    <asp:Repeater ID="rptMarkers" runat="server">
    <ItemTemplate>
             {
                "title": '<%# Eval("title") %>',
                "lat": '<%# Eval("lat") %>',
                "lng": '<%# Eval("lng") %>',
                "description": '<b><%# Eval("title") %></b> <br><%# Eval("address") %>'
            }
    </ItemTemplate>
    <SeparatorTemplate>
        ,
    </SeparatorTemplate>
    </asp:Repeater>
    ];
    </script>

 <script type="text/javascript">

        window.onload = function () {
            Dataload();
        }
        function Dataload() {
            var mapOptions = {
                center: new google.maps.LatLng(markers[0].lat, markers[0].lng),
                zoom: 13,
                disableDefaultUI: true,
                mapTypeId: google.maps.MapTypeId.ROADMAP
            };
            var infoWindow = new google.maps.InfoWindow();
            var map = new google.maps.Map(document.getElementById("dvMap"), mapOptions);
            for (i = 0; i < markers.length; i++) {
                var data = markers[i]
                var myLatlng = new google.maps.LatLng(data.lat, data.lng);
                var marker = new google.maps.Marker({
                    position: myLatlng,
                    map: map,
                    title: data.title
                });
                (function (marker, data) {
                    google.maps.event.addListener(marker, "click", function (e) {
                        infoWindow.setContent(data.description);
                        infoWindow.open(map, marker);
                    });
                })(marker, data);
            }
        }
    </script>


Retrieve data from visible false BoundField of Gridview

get value of visible false boundfield in gridview Asp.net

<style type="text/css">
     .hidden
     {
         display:none;
     }
</style>

<asp:BoundField DataField="ReportId" HeaderText="RId"  >
    <ItemStyle CssClass="hidden"/>
</asp:BoundField>

Gridview row hover alert rowindex

on hover Gridview row, show row index as alert message

write onmouseover on rowdatabound

protected void mygridview_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowIndex != -1)
{
e.Row.Attributes["onmouseover"] = "showContents('" + (e.Row.RowIndex + 1) + "')";
}

}

 <script type="text/javascript">
        function showContents(rowIndex) {

            var gv = <%= mygridview.ClientID %>;
            var rowElement = gv.rows[rowIndex];
            var title = rowElement.cells[0].innerHTML;
            alert(rowIndex + ',' + title);

}

Wednesday, 26 June 2013

select from table distinct column

SELECT * FROM TABLE WITH DISTINCT COLUMN
---------------------------------------------------------------

SELECT * FROM [TABLE NAME]
WHERE [ID] IN (
  SELECT MIN([ID]) FROM [TABLE NAME] GROUP BY [DISTINCT COLUMN NAME])

Example:

       SELECT FROM [SKILLS] WHERE [ID] IN
       (
      SELECT MIN([ID]) FROM [SKILLS] GROUP BY [SKILL NAME]
       )

Friday, 21 June 2013

string split using jquery / java script

var a = "one,two,three".split(",") // Delimiter is a string
for (var i = 0; i < a.length; i++)
{
alert(a[i])
}

var b = "1+2=3".split(/[+=]/) // Delimiter is a regular expression
for (var i = 0; i < b.length; i++)
{
alert(b[i])
}

Friday, 14 June 2013

500 Internal Server Error” when adding HttpModule in my Web.config

use the following new module syntax made for IIS7 (godaddy is using IIS7 for windows hosting)
<configuration>
   <system.webServer>
      <modules>
         <add name="Header" type="Contoso.ShoppingCart.Header"/>
      </modules>
   </system.webServer>
</configuration>
here details about module tag  

Convert SVG to PNG using svg.dll

      <div id="divsvg">        <svg width="350" height="300"><defs></defs> ............