Sunday 17 June 2018

How to Send messages through whatsApp Using Asp.Net PART - I

Dear all In this article i would like to emphasize How to Send messages through WhatsApp using Asp.Net.In my previous article i explained essence of articles relate to C#.Net,Asp.Net,Interview Questions,XML Related Articles and Sql Server Related articles.Let's have a Deep dive of this implementation. 
About WhatsApp:



Which is one of the fastest growing messenger platform throughout the world.In an day to day life there is an Trillions of messages were delivered through whatsApp by this we can get understood such a fastest communication medium

Day by Day user perceptions were increasing like anythig.In my earlier articles i explained about How to Send an Messages through Asp.Net.How to send an Messages through PHP Code.Now lets Discuss How to Send messages through WhatsApp using Asp.Net.





Source Code :

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="W1.aspx.cs" Inherits="W1" %>



<!DOCTYPE html>


<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    <script>
        $(document).ready(function () {
            var AList = [];
            AList[0] = 'http://seoveerendra.blogspot.com/search/label/JavaScript';
            AList[1] = 'http://seoveerendra.blogspot.com/search/label/ScholarShips';
            AList[2] = 'http://seoveerendra.blogspot.com/search/label/NEWS';
            AList[3] = 'http://seoveerendra.blogspot.com/search/label/Editorial';
          
            $(document).on("click", '.whatsapp', function () {
                var sMsg = "";
                $IDs = $("#example input:checkbox:checked").map(function () {
                    return $(this).attr("id");
                }).get();

                for (var i = 0; i < $IDs.length; i++) {
                    var text = $IDs[i];                   
                    sMsg = sMsg + AList[text.replace('chk_', '')] + "%20";
                }
                var whatsapp_url = "https://api.whatsapp.com/send?phone=+91XXXXXXXXXX&text=" + sMsg;
                window.open(whatsapp_url, '_blank');

            });
        });
    </script>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <table id="example">
                <tr>
                    <th></th>
                    <th>Category</th>
                </tr>
                <tr>
                    <td>
                        <input type="checkbox" id="chk_0" /></td>
                    <td> Client Side Script (Java Script / JQuery)</td>
                </tr>
                <tr>
                    <td>
                        <input type="checkbox" id="chk_1" /></td>
                    <td> ScholarShips Information</td>
                </tr>
                <tr>
                    <td>
                        <input type="checkbox" id="chk_2" /></td>
                    <td>News</td>
                </tr>
                <tr>
                    <td>
                        <input type="checkbox" id="chk_3" /></td>
                    <td>Editorial</td>
                </tr>
            </table>
            <asp:ImageButton ImageUrl="~/wa.png" runat="server" CssClass="whatsapp" />
        </div>
    </form>
</body>
</html>

No comments :

Post a Comment