Skip to main content

Posts

What is Ref and out parameters in c# ?

About Ref and out parameters in c#! Introduction : ref : we can pass an argument as a referance with this keyword. If any changes happen in the methos then the value will be reflected in the calling method. The value of the ref variable mustbe initalized befour calling the methos. Static keyword we have to use in the method. Syntex: public static return_type method_name(ref variable_name) { // body of the method } out : The functionality of out key word is also same like ref but here we can pass an argument without initalized the value. Here also static key word have to use. Syntex: public static return_type method_name(out variable_name) { // body of the method } Example : using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace codePractice {          class Program         {              static voi...

How to Copy one datatable to another datatable

Introduction : In this article i am going to share about how to copy a datatable to a new datatable object , and how to add a new row to the datatable. Overview : Generally we used datatable object to store out table data, sometime we want to store that datatable temporally to a another datatable object that time we need to copy the datatable and store to newly created object . It's a best practice to copy our main datatable when we need that datatable multiple times  and used the copyed object. We can add a new column dynamically to the newly created object. Code Example : Syntex : DataTable dest = MainDatatable; Connection String : <connectionStrings>    <add name="conn" connectionString="Data Source=anil\SQLEXPRESS2012;Initial Catalog=MyDB; User ID=sa;Password=sa1" providerName="System.Data.SqlClient" />  </connectionStrings> C# Code : SqlConnection con = new SqlConnec...

How to Get JSON Data formate in Asp.net ???

Get JSON Data formate In Asp.net    (Without any third party libary file)           Steps 1: Nessary Namespace  __       using System.Web.Script.Serialization;        Steps 2: put the Folloing code__        [WebMethod]        public void getAllTheData()        {            SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["con"].ToString());            con.Open();            List<employee> emp = new List<employee>();            SqlCommand cmd = new SqlCommand("spgetData", con); ...

Bootstrap Delete Confirmation popup

<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server">     <title>Bootstrap Popup message</title>     <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />     <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" />     <script type="text/javascript">         function getConfirmation(sender, title, message) {             $("#ModalTitle").text(title);             $("#ModalMsg").text(message);             $('#modalPopUp').modal('show');             return false;         }     </script>     <style type="text/css">         i {       ...

Date picker in asp.net !!!

Date Picker Using Bootstrap and ASP.net <html> <head> <title>Date Picker Using Bootstrap and ASP.net</title> <link href="../bootstrap-3.3.7-dist/bootstrap-datepicker/css/bootstrap-datepicker.css" rel="stylesheet" type="text/css" /> </head>      <body>                 <form ID="Form1" runat="server">                 <div class="col-md-4 col-xs-6 col-xs-offset-3 col-md-offset-0">                     <div class="form-group">                         <div class="has-feedback">      ...