Monday, March 28, 2016

ASP.NET: Generate QR code image using Google Chart API

In this article I am going to explain how to generate QR code image using Google Chart API in

QR code image will be generating using Google chart API with a url get request.

HTML Markup:
<fieldset style="width:30%">
        <legend>Generate QR Code using Google API</legend>
        <tr><td>Enter URL OR Text:</td><td><asp:TextBox ID="txturl" runat="server"></asp:TextBox></td></tr>
        <tr><td colspan="2"><asp:Image runat="server" ID="QRImage"/></td></tr>

        <tr><td></td><td><asp:Button ID="btnsubmit" runat="server" Text="Generate QR Code" onclick="btnsubmit_Click" /></td></tr>

Generate QR code
On Button click write the below given code.
C# code:
protected void btnsubmit_Click(object sender, EventArgs e)
            var url = "" + txturl.Text + "";
            QRImage.ImageUrl = url;
        catch(Exception ex)
    } Code:
Protected Sub btnsubmit_Click(sender As Object, e As System.EventArgs) Handles btnsubmit.Click
            Dim url = "" + txturl.Text + ""
            QRImage.ImageUrl = url
        Catch ex As Exception
        End Try
    End Sub

No comments:

Post a Comment