Posts

Showing posts from April, 2015

Multiple DataTextField In Dropdownlist in Asp.Net C#

Image
  DataTable dt = ds.Tables[0];   if (dt.Rows.Count > 0)                     {                         Dictionary<int, string> lst = new Dictionary<int, string>();                         foreach (DataRow row in dt.Rows)                         {                             //Add values to Dictionary                             string val = row[1].ToString() + " " + row[2].ToString() + " - " + row[3].ToString();                             lst.Add(Convert.ToInt32(row[0]), val);           ...

Store data from DataTable to List Generic Class in c#

A  List  is a strongly typed list of objects that can be accessed by index.  It can be found under  System.Collections.Generic  namespace.     DataTable dt = ds.Tables[0];     List<clsDispatch> DispatchDetails = new List<clsDispatch>();                 List<clsDispatch> DispatchDetails = new List<clsDispatch>();                         DispatchDetails = (from DataRow row in dt.Rows                                select new clsDispatch                                {                                    DespID = Convert.ToInt64(row["DespID"].ToString()), ...