Posts

Showing posts from December, 2018

Dynamic Form

namespace MyApp {     /// <summary>     /// Summary description for RemotePost     /// </summary>     public class RemotePost     {        private System.Collections.Specialized.NameValueCollection Inputs = new System.Collections.Specialized.NameValueCollection();         public string Url = "";         public string Method = "post";         public string FormName = "form1";         public void Add(string name, string value)         {             Inputs.Add(name, value);         }         public void Post()         {             System.Web.HttpContext.Current.Response.Clear();             System.Web.HttpContext.Current.Response.Write("<html><head runat='server'>");             System.Web.HttpContext.Current.Response.Write(string.Format("</head><body onload=\"document.{0}.submit()\">", FormName));             System.Web.HttpContext.Current.Response.Write(string

Linq Exclude from separate list

 var urlList = new List<DisplayAssets>();    var assetsToExclude = (from a in db.DisplayAssets                 join h in db.Hardware_Assets on a.id equals h.displayId                 where h.assetId == hardwareid                 select a.id); var allAssets = db.DisplayAssets; var urls = allAssets.Where(x => !assetsToExclude.Contains(x.id));         urlList = urls.Select(a => new DisplayAssets()         {             locaterAddress  = a.locaterAddress,             assetType = a.assetType,             id = a.id         })         .ToList();