Topic: ASP.NET

Integerate Google Maps To asp.net web mvc 0

Integerate Google Maps To asp.net web mvc

Today, We want to share with you Integerate Google Maps To asp.net web mvc.
In this post we will show you Use Google Maps in ASP.Net, hear for google maps integration in asp.net we will give you demo and example for implement.
In this post, we will learn about working with google maps in asp.net with an example.

Integerate Google Maps To asp.net web mvc

There are the Following The simple About Integerate Google Maps To asp.net web mvc Full Information With Example and source code.

As I will cover this Post with live Working example to develop google maps integration in asp.net, so the some major files and Directory structures for this example is following below.

  • Default.aspx.cs

Google maps example html

Default.aspx.cs

This is where I will make a simple HTML form and PHP server side source code for our web application. To make the forms simply all souce code copy and write it into your any text editor Like Notepad++, then save file it as Default.aspx.cs.

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

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>use google maps in asp.net</title>
    <style>
        /* Always set the live_asp_maps height explicitly Google maps in asp.net web to define your perfect the size of the div
       * element that contains the live_asp_maps. */
        #live_asp_maps {
            height: 580px;
        }
        /* Optional: Use Google Maps in ASP.Net Makes the sample page fill the window. */
        html, body {
            height: 100%;
            margin: 0;
            padding: 0;
        }
    </style>

    <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>

    <script>
        var live_asp_maps;
        function google_maps_asp_net() {
            var mapOptions = {
                zoom: 9, // google maps api zoom                                   
                center: new google.maps.LatLng(29.512346, 52.0758713), // Your Live latitude and longitude live_asp_maps
                mapTypeId: google.maps.MapTypeId.ROADMAP   //declare google maps types Like TERRAIN & SATELLITE, ROADMAP
            };
            live_asp_maps = new google.maps.Map(document.getElementById('live_asp_maps'), mapOptions);
        }
    </script>
</head>
<body onload="google_maps_asp_net();">
    <form id="form1" runat="server">
        <h1>google maps integration in asp.net</h1>
        <div>
            <div id="live_asp_maps"></div>
        </div>
    </form>
</body>
</html>

Google maps in asp.net web – output

Integerate Google Maps To asp.net web mvc - output

Integerate Google Maps To asp.net web mvc – output

Angular 6 CRUD Operations Application Tutorials

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Google Map Using Bootstrap In ASP.NET MVC.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Convert Byte Array to Image File C# and VB.Net 0

Convert Byte Array to Image File C# and VB.Net

Today, We want to share with you Convert Byte Array to Image File C# and VB.Net.
In this post we will show you MVC : Display Image From Byte Array using C# , hear for c# – Converting a byte array to PNG/JPG we will give you demo and example for implement.
In this post, we will learn about Convert System.Drawing.Image to Byte Array using C# and VB.Net with an example.

Convert Byte Array to Image File C# and VB.Net

There are the Following The simple About Convert Byte Array to Image File C# and VB.Net Full Information With Example and source code.

As I will cover this Post with live Working example to develop convert an image to byte array in vb.net, so the some major files and Directory structures for this example is following below.

  • Default.aspx
  • Default.aspx.cs

Convert image to byte array ASP.Net C#

Default.aspx

This is where I will make a simple HTML form and PHP server side source code for our web application. To make the forms simply all souce code copy and write it into your any text editor Like Notepad++, then save file it as Default.aspx.

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Convert Byte Array to Image File C# Example</title>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <h2>How to upload image on server in asp.net using c#</h2>
            <asp:FileUpload ID="liveUploadFileCtrl" runat="server" />
            <asp:Button runat="server" ID="UploadButton" Text="Upload" OnClick="FileUploadBtn_Click" />
            <br />
            <br />
            <asp:Label runat="server" ID="MessageLabel" Text="Upload Message: " />
            <asp:Image ID="showImg" runat="server"></asp:Image>
        </div>
    </form>
</body>
</html>

c# – How to convert image to byte array

Default.aspx.cs

using System;
using System.Drawing;
using System.IO;
public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
    }
    protected void FileUploadBtn_Click(object sender, EventArgs e)
    {
        if (liveUploadFileCtrl.HasFile)
        {
            try
            {
                string filename = Path.GetFileName(liveUploadFileCtrl.FileName);
                liveUploadFileCtrl.SaveAs(Server.MapPath("~/") + filename);

                var myObj = new LiveImgConvertor();

                System.Drawing.Bitmap bmpPostedImage =
                    new System.Drawing.Bitmap(liveUploadFileCtrl.PostedFile.InputStream);

                byte[] memoryImgByteArr = myObj.ConvertImageToByteArray(bmpPostedImage, ".png");
                System.Drawing.Image imageIn = myObj.ByteIntoImgConvert(memoryImgByteArr);

                string saveImagePath = Server.MapPath("~/images/") + "Image1.png";
                File.WriteAllBytes(saveImagePath, memoryImgByteArr);

                MessageLabel.Text = "Upload Message: File uploaded!'";
                MessageLabel.ForeColor = Color.blue;
            }
            catch (Exception ex)
            {
                MessageLabel.Text = ex.Message;
            }
        }
    }
}

LiveImgConvertor.cs

Convert Image to byte[] array
Convert byte[] array to Image

using System.Drawing;
using System.IO;

public class LiveImgConvertor
{
    public LiveImgConvertor()
    {
    }
    public Image ByteIntoImgConvert(byte[] totalByteArrIn)
    {
        using (LiveMemStream ms = new LiveMemStream(totalByteArrIn))
        {
            return Image.FromStream(ms);
        }
    }
    public byte[] ConvertImageToByteArray(Image image, string extension)
    {
        using (var liveMemStream = new LiveMemStream())
        {
            switch (extension)
            {
                case ".jpeg":
                case ".jpg":
                    image.Save(liveMemStream, System.Drawing.Imaging.ImageFormat.Jpeg);
                    break;
                case ".png":
                    image.Save(liveMemStream, System.Drawing.Imaging.ImageFormat.Png);
                    break;
                case ".gif":
                    image.Save(liveMemStream, System.Drawing.Imaging.ImageFormat.Gif);
                    break;
            }
            return liveMemStream.ToArray();
        }
    }
}

Angular 6 CRUD Operations Application Tutorials

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Convert and save Byte Array as Image File using C#.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

ASP.NET AJAX partial postback in UpdatePanel control 0

ASP.NET AJAX partial postback in UpdatePanel control

Today, We want to share with you ASP.NET AJAX partial postback in UpdatePanel control.In this post we will show you ASP.NET AJAX partial postback solutions, hear for How to enable partial rendering with the AJAX UpdatePanel we will give you demo and example for implement.In this post, we will learn about All About UpdatePanel partial postback in Asp.Net with an example.

ASP.NET AJAX – What is a Partial Postback?

Updatepanel is used to perform partial postback of the page. UpdatePanel eliminates the need of a refresh of the whole page in each
postback request. This control is located inside Ajax Extensions tabs inside a toolbox.

The can have two childtags.

1. ContentTemplate: The content can be any valid tag that you normally put on your page, from literal text to web controls or data contol.
2. Trigger: The Triggers tag allows you to define certain triggers which will make the panel update it’s content.

In the following example,’Update Both’ button cause update of both updatepanel whereas ‘Update’ will update only main updatepanel.
You need to add a ScriptManager tag while using any Ajax contol in asp.net web form application.







    <title>UpdatePanel control in ASP.NET for partial postback</title>


     <form id="frmMain">
        
        
        
            
        
            
                
                               
            
        
                   
            
                
                
            
        
    </form>


 

CodeBehind

protected void UpdateButton_Click(object sender, EventArgs e)
{
  lblDateTimeLabel1.Text = DateTime.Now.ToString();
  lblDateTimeLabel2.Text = DateTime.Now.ToString();
}

Try running above example, and observe the effect of both buttons. You can notice that first button update only first datestamp whereas second button cause update of both datestamps.

The AsyncPostBackTrigger tag is also easy to understand- it takes only two attributes, the controlid, a reference to the control which can trigger it, and the eventname, which tells which event type will cause the trigger to fire.

Read :

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about ASP.NET AJAX partial postback in UpdatePanel control.I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

How to Open URL in New Tab using c# 0

How to Open URL in New Tab using c#

Today, We want to share with you How to Open URL in New Tab using c#.
In this post we will show you c# open url in new window code behind, hear for how to open page in new tab using response.redirect in asp.net c# we will give you demo and example for implement.In this post, we will learn about Opening a URL in a new tab in C# Asp.NET with an example.

My Paka Knowledgeable Ideas, Tips and Tricks, Useful Content, Jobs, Technology, Earn Money, gmail creation, skype, yahoo and more useful things.

In asp.net,c#, Open new window when target=”_blank”

<Link to="/about" target="_blank">About Pakainfo.com</Link>

asp.net,c# Overview with Features

There are the Following the List of Features For asp.net,c# Pure JavaScript Latest Frameworks.

  • Component oriented
  • Fast speed
  • Interoperability
  • Modern programming language
  • Object oriented
  • Rich Library
  • Scalable and Updateable
  • Simple
  • Structured programming language
  • Type safe

asp.net,c# redirect to a new tab

Response.Write(String.Format("window.open('{0}','_blank')", ResolveUrl(https://pakainfo.com/)));

ClientScript.RegisterStartupScript(this.Page.GetType(), "",
  "window.open('https://pakainfo.com/','Graph','height=400,width=500');", true);

How to code to open new tab in asp.net,c#

//Opening a URL in a new tab

Protected Sub btnReport_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnReport.Click
      Dim popupScript As String = "<script language="javascript">" + "window.open('https://pakainfo.com/', 'newWindow', 'left=5, top=2,location=no, width=560, height=450, menubar=no, resizable=yes,statusbar=yes,scrollbars=yes');" + "</script>"
      Page.RegisterStartupScript("Google", popupScript)
  End Sub

asp.net,c# Redirects

<asp:Button ID="btnTransfer" OnClick="btnliveTransfer_Click" runat="server" Text="Submit"/>

//on click events
protected void btnliveTransfer_Click(object sender, EventArgs e)
{
    Response.Redirect("~/pakainfo.aspx");
}


asp.net,c# Redirecting To External Domains

public ActionResult PakaLiveAction()
{
    // ...
    return Json(new {url = "https://pakainfo.com/"});
}

$.post("@Url.Action("PakaLiveAction")", function(data) {
    window.location = data.url;
});

jQuery 15 Powerful Tips and Tricks for Developers and Web Designer

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about c# response.redirect new window.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

C# Named Arguments Tutorial with Examples 0

C# Named Arguments Tutorial with Examples

Today, We want to share with you C# Named Arguments Tutorial with Examples.
In this post we will show you Named and Optional Arguments in C#, hear for Named And Optional Parameter In C# we will give you demo and example for implement.
In this post, we will learn about C# Named Parameters with an example.

Introduction: Named Arguments In C#

In this post, we will learn about Named Arguments In C# with an example.

C# Named and Optional Arguments Tutorial with Examples

Now in this post, I will explain about Named Arguments In C# with appropriate example. Normally, In Methods call, arguments are supplied as per the order of parameters defined in the method definition. So, when making a method call, it is important for you to remember the order of parameters before passing the value to the method call. If the number of parameters is large, then it is difficult to remember the order.

To handle this problem, Named arguments are used. When calling a method, arguments are passed with the parameter name followed by a colon and a value. In Named Arguments, we do not need to pass the parameters in order as defined on method definition, so we can pass the arguments in any order on method calling.

Now create Console Application in Visual Studio and write below lines of code in it.

using System;
using System.Collections;

namespace ConsoleDemo
{   
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("pakainfo.com");

            Program.EmployeeDetails(Employee_No: 4, EmployeeName: "Jd patel", Department: "HR", id: 2);

            // Arguments are passed in different order,which is diffrent from method declaration.
            Program.EmployeeDetails(EmployeeName: "Jaydeep", Employee_No: 44, id: 1, Department: "Finance");
            Console.ReadLine();  
        }
        public static void EmployeeDetails(int Employee_No, string EmployeeName, int id, string Department)
        {
            Console.WriteLine(string.Format("Employee_No : {0}, Name: {1}, id: {2}, Department: {3}", Employee_No, EmployeeName, id, Department));
        }
    }   
}

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about how to pass optional parameter in c#.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

C# nested while loops and multiple conditions 0

C# nested while loops and multiple conditions

Today, We want to share with you C# nested while loops and multiple conditions.
In this post we will show you Nested loops in C# programming, hear for c# while true Check we will give you demo and example for implement.
In this post, we will learn about c# while loop multiple conditions with an example.

Nested while Loop in C#

Syntax for Nested while Loop in C#:

while (condition)
{
    while (condition)
    {
        your statements;
    }
    your statements;
}

Nested loops in C# programming

while ((!mystring.Contains("pakainfo")) || (NewData != OldData) || (totalcount < 100))
{
    //while at least more to one those right conditions is true, then  this while loop will work
}

Is logically equivalent to your

while ((v3.IsAlive) || ((v2.IsAlive) || v1.IsAlive))
//do stuff

jQuery 15 Powerful Tips and Tricks for Developers and Web Designer

die when v3 ends or when both v2 and v1 end

while (v3.IsAlive || v2.IsAlive || v1.IsAlive)
//do stuff

Example 1: C# program of Nested while Loop

using System;
namespace loop
{
    class Wprogram
    {
        static void Main(string[] args)
        {
            int startpoint = 5;
            while (startpoint >= 1)
            {
                int j = 5;
                while (j >= startpoint)
                {
                    Console.Write(j);
                    j--;
                }
                startpoint--;
                Console.WriteLine();
            }
            Console.Read();
        }
    }
}

OutPut : C# program of Nested while Loop

5
54
543
5432
54321

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about C Sharp Looping with do and while Statements.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

C# instance For Object Abstract Classes 0

C# instance For Object Abstract Classes

Today, We want to share with you C# instance For Object Abstract Classes.
In this post we will show you instance for Abstract Classes in C#, hear for can we create object of abstract class in c# we will give you demo and example for implement.
In this post, we will learn about create instance of abstract class c# with an example.

Can we create the instance for abstract classes?

In this post, we will learn about Can we create the instance for abstract classes with description.

My Paka Knowledgeable Ideas, Tips and Tricks, Useful Content, Jobs, Technology, Earn Money, gmail creation, skype, yahoo and more useful things.

Now create Console Application in Visual Studio and write below lines of code in it.

Now in this post, I will explain Can we create the instance for abstract classes with description.

Introduction To jQuery

It is not possible to create an instance of an abstract class since it does not have a complete implementation. The use of an abstract class is to function as a base for subclasses of another class. It works like a template, or an empty or partially empty structure, you should extend it and build on it before you can use it.

abstract class TestAbstractClass 
{

}

TestAbstractClass obj = new TestAbstractClass (); // not valid, as explained above

jQuery 15 Powerful Tips and Tricks for Developers and Web Designer

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about can we create instance of interface in c#.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

We hope This Post can help you…….Good Luck!.

C# Calculate Age Tutorial with Examples 0

C# Calculate Age Tutorial with Examples

Today, We want to share with you C# Calculate Age Tutorial with Examples.
In this post we will show you How to Calculate age from Date of Birth in C#, hear for Calculating age from date of birth – C# we will give you demo and example for implement.
In this post, we will learn about C# Calculate age from Date of Birth with an example.

calculate someone’s age in C#

In this post, we will learn about how to calculate someone’s age in C# with an example.

My Paka Knowledgeable Ideas, Tips and Tricks, Useful Content, Jobs, Technology, Earn Money, gmail creation, skype, yahoo and more useful things.

Now in this post, I will explain how to calculate someone’s age in C# with appropriate example.

Now create Console Application in Visual Studio and write below lines of code in it.

using System;
using System.Collections;
using System.Collections.Generic;
namespace PakaInfo
{
    class Program
    {
        static void Main(string[] args)
        {
            DateTime _BirthDate = new DateTime(1991, 10, 29);
            DateTime _Now = new DateTime(2017, 12, 23);
            Console.WriteLine(string.Format("Age : {0}", GetAge(_BirthDate, _Now)));
            Console.ReadKey();
        }

        public static int GetAge(DateTime p_BirthDate, DateTime p_Now)
        {
            int age = p_Now.Year - p_BirthDate.Year;

            if (p_Now.Month < p_BirthDate.Month || (p_Now.Month == p_BirthDate.Month && p_Now.Day < p_BirthDate.Day))
                age--;

            return age;
        }
    }
}

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about C# Calculate Age Tutorial.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

We hope This Post can help you…….Good Luck!.

C# Hash table and Dictionary Tutorial with Examples 0

C# Hash table and Dictionary Tutorial with Examples

Today, We want to share with you C# Hash table and Dictionary Tutorial with Examples.
In this post we will show you Why is Dictionary preferred over Hashtable?, hear for hashtable vs dictionary c# performance we will give you demo and example for implement.
In this post, we will learn about difference between hashtable and dictionary and arraylist in c# with an example.

Why is Dictionary preferred over Hashtable?

In this post, we will learn about Why is Dictionary preferred over Hashtable? with an example.

Now create Console Application in Visual Studio and write below lines of code in it.

Now in this post, I will explain Why is Dictionary preferred over Hashtable? with appropriate example. Dictionary is generic whereas Hashtable is not Generic. We can add any type of object to HashTable, but while retrieving we need to cast it to the required type. So, it is not type-safe. But to the dictionary, while declaring we can specify the type of key and value, so there will be no need to cast while retrieving.

C# Hashtable Example

using System;
using System.Collections;
namespace Pakainfo
{
    class Program
    {
        static void Main(string[] args)
        {
            Hashtable _SiteList = new Hashtable();
            _SiteList.Add(1, "Pakainfo.com");
            _SiteList.Add(2, "Infinityknow.com");
            _SiteList.Add(3, "pakainfo.blogspot.com.com");
            foreach (DictionaryEntry de in _SiteList)
            {
                int Key = (int)de.Key; //Casting
                string value = de.Value.ToString(); //Casting
                Console.WriteLine(Key + " " + value);
            }          

            Console.ReadKey(); // To hold the console screen.
        }
    }
}

C# Dictionary Example

using System;
using System.Collections;
using System.Collections.Generic;
namespace Pakainfo
{
    class Program
    {
        static void Main(string[] args)
        {
            Dictionary<int, string> _SiteList = new Dictionary<int, string>();
            _SiteList.Add(1, "pakainfo.com");
            _SiteList.Add(2, "infinityknow.comm");
            _SiteList.Add(3, "pakainfo.blogspot.com");
            foreach (KeyValuePair<int, String> kv in _SiteList)
            {
                Console.WriteLine(kv.Key + " " + kv.Value);
            }
            Console.ReadKey(); // To hold the console screen.
        }
    }
}

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about c# hashtable vs dictionary vs hashset.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

C# convert Decimal to Binary octal hexadecimal Examples 0

C# convert Decimal to Binary octal hexadecimal Examples

Today, We want to share with you C# convert Decimal to Binary octal hexadecimal Examples.
In this post we will show you C# Program to convert Decimal to Binary, hear for Write a program in C# Sharp to convert a decimal number to binary we will give you demo and example for implement.
In this post, we will learn about C# Sharp exercises: Decimal to Binary with an example.

C# Program to convert Decimal to Binary

In this post, we will learn about C# Program to convert Decimal to Binary with an example.

Now in this post, I will explain C# Program to convert Decimal to Binary with appropriate example.

Now create Console Application in Visual Studio and write below lines of code in it.

using System;
namespace PakaInfo
{
    class Program
    {
        static void Main(string[] args)
        {
            // C# Program to convert Decimal to Binary

            int _Number, i;
            int[] a = new int[10];
            Console.Write("Enter the number to convert to binary: ");
            _Number = int.Parse(Console.ReadLine());
            for (i = 0; _Number > 0; i++)
            {
                a[i] = _Number % 2;
                _Number = _Number / 2;
            }
            Console.Write("Binary of the given number= ");
            for (i = i - 1; i >= 0; i--)
            {
                Console.Write(a[i]);
            }     

            Console.ReadKey(); // To hold the console screen.
        }
    }
}

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about c# – Function that convert decimal to binary.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.