Open Your Visual Studio, go to File-> New Web Site and choose ASP.NET Web Form Site and name it as -> [slideshow_demo]. Step 2 In Solution Explorer, you get your demo Website. There will be many files, but we just…

ASP.NET Core 1.0.1 Hosting: How To Import XML File Data Into SQL Table Using Stored Procedure In ASP.NET?
I have an XML file (student), which stores the information of the student and want to import its data into SQL table. Student.xml file looks, as shown below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
<?xml version="1.0" encoding="utf-16" ?> <students> <student> <name>Tarun</name> <class>X</class> <roll_no>1234</roll_no> </student> <student> <name>Ram</name> <class>X</class> <roll_no>1235</roll_no> </student> <student> <name>Rajeev</name> <class>X</class> <roll_no>1236</roll_no> </student> <student> <name>Gopal</name> <class>X</class> <roll_no>1237</roll_no> </student> </students> |
Implementation I have created a Student table. Id int name …

ASP.NET Core 1.0.1 Hosting: Session.Abandon() Method in ASP.NET
The HttpSessionState.Abandon() method destroys all objects stored in a Session object and releases their resources. We call this method in ASP.Net with Session.Abandon(). This method has no parameters and has no return value. For using Abandon() method you must add…

ASP.NET Core 1.0.1 Hosting: Basic Authentication Using Message Handlers In Web API
n order to perform authentication of Web API, we can use basic authentication. This authentication can either be performed by using HTTP handlers or by using the message handlers. Both handler types are different but message handlers are more specific…

ASP.NET Core 1.0.1 Hosting: Identify Which .NET Framework Is Installed
Are you involved in end-to-end solution delivery or do you have responsibility to ensure successful deployment of your .NET solution on a Server box? If yes, then you need to make sure that the right version of .NET Framework is…

ASP.NET Core 1.0.1 Hosting: How To Troubleshoot The Icon File Association Issue In ClickOnce Deployment?
Today, while working on an application for ClickOnce deployment, I faced a small issue, which took almost a half an hour. My task was to associate a default icon to my Application. Thus, in order to do this, I went…
ASP.NET Core 1.0.1 Hosting: Advantages Of Razor Syntax And Difference Between @Html.Editorfor And @Html.TextBoxFor
First of all, we will look into some of the main advantages of use of Razor syntax. It is light weight and it has a simple syntax. It is easier to understand Razor syntax as compared to ASPX view engine…

ASP.NET Core 1.0.1 Hosting: How to Dynamic Auto Complete in MVC for any Table of DataBase?
Through this tutorial, we can file record of product code on the basis of product name. View
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 |
@model string < input type = "hidden" value = "@Model" / > @Html.TextBox("txtCode_" + @Model) @Html.TextBox("txtName_" + @Model) < script type = "text/javascript" > $(function () { { source: function (request, response) { alert("hi"); $.ajax( { dataType: "json", type: 'POST', data: { name: request.term }, success: function (data) { response(data); } }); }, autoFocus: true, select: function (event, ui) { var mData; var unit; $.ajax( { url: "/Common/GetCodeName/" + id, type: 'POST', data: { codeName: ui.item.value, mPara: 'N' }, success: function (_result) { // alert(_result); mData = _result.UserName; unit = _result.unitdata; setTimeout(function () { }, 1000); } }); }, minLength: 1 }); { source: function (request, response) { $.ajax( { dataType: "json", data: { code: request.term }, success: function (data) { response(data); }, type: 'POST' }); }, autoFocus: true, select: function (event, ui) { var mData; var unit; $.ajax( { url: "/Common/GetCodeName/" + id, type: 'POST', data: { codeName: ui.item.value, mPara: 'C' }, success: function (_result) { unit = _result.unitdata; mData = _result.UserName; setTimeout(function () { }, 1000); } }); }, minLength: 1 }); }); < /script> Controller-- -- -- -- -- -- -- -- -- -- -- --[HttpPost] public JsonResult AutocompleteName(string id, string name) { var TblSet = Core.CoreCommon.GetTableData(id); var output = TblSet.AsQueryable().ToListAsync().Result.ToList(); Dal.TFAT_WEBERPEntities context = new Dal.TFAT_WEBERPEntities(); return Json(from m in output where m.GetType().GetProperty("Name").GetValue(m).ToString().Contains(name) select m.GetType().GetProperty("Name").GetValue(m).ToString()); } [HttpPost] public JsonResult AutocompleteCode(string id, string code) { var TblSet = Core.CoreCommon.GetTableData(id); var output = TblSet.AsQueryable().ToListAsync().Result.ToList(); return Json(from m in output where m.GetType().GetProperty("Code").GetValue(m).ToString().Contains(code) select m.GetType().GetProperty("Code").GetValue(m).ToString()); } [HttpPost] public ActionResult GetCodeName(string id, string codeName, string mPara) { var TblSet = Core.CoreCommon.GetTableData(id); var output = TblSet.AsQueryable().ToListAsync().Result.ToList(); Dal.TFAT_WEBERPEntities context = new Dal.TFAT_WEBERPEntities(); string UserName = ""; string unitdata = ""; string Product = ""; if (mPara == "C") { var query = (from m in output where m.GetType().GetProperty("Code").GetValue(m).ToString().Contains(codeName) select m.GetType().GetProperty("Name").GetValue(m).ToString()); if (id == "ItemMaster") { var query1 = (from m in output where m.GetType().GetProperty("Code").GetValue(m).ToString().Contains(codeName) select m.GetType().GetProperty("Unit").GetValue(m).ToString()); var NewQuery = (from c in output where c.GetType().GetProperty("Code").GetValue(c).ToString().Contains(codeName) select c.GetType().GetProperty("Name").GetValue(c).ToString()); if (query1 != null) { unitdata = query1.First().ToString(); } if (NewQuery != null) { Product = NewQuery.First().ToString(); } } if (query != null) { UserName = query.First().ToString(); } } else { var query = (from m in output where m.GetType().GetProperty("Name").GetValue(m).ToString().Contains(codeName) select m.GetType().GetProperty("Code").GetValue(m).ToString()); if (query != null) { UserName = query.First().ToString(); } } return Json(new { UserName, unitdata, Product }); // return Content(UserName); } Common Class-- -- -- -- -- -- -- -- -- - public class CoreCommon { public static object GetTableObject(string TableName) { Type mType = BuildManager.GetType(string.Format("TFATERPWebApplication.Dal.{0}", TableName), true); return System.Activator.CreateInstance(mType); } public static Type GetTableType(string TableName) { return BuildManager.GetType(string.Format("TFATERPWebApplication.Dal.{0}", TableName), true); } public static DbSet GetTableData(string tablename) { var mType = BuildManager.GetType(string.Format("TFATERPWebApplication.Dal.{0}", tablename), true); TFAT_WEBERPEntities ctx = new TFAT_WEBERPEntities(); return ctx.Set(mType); } public static string GetString(string[] col) { StringBuilder sb = new StringBuilder(); foreach(string s in col) { sb.Append(s); sb.Append(","); } return sb.ToString().Substring(0, sb.Length - 1); } } |
HostForLIFE.eu ASP.NET Core 1.0.1 Hosting

ASP.NET Core 1.0.1 Hosting – How to Create Menu Based on Authorized Roles?
In this post, I will tell you about how to create Menu Based on Authorized Roles. Create an interface ‘INavData’ which holds values for the menu and Create a class ‘NavData’ from the interface with all those properties.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
public interface INavData { string ImageFileNameWithNoExtn { get; set; } string AreaName { get; set; } bool IsActive { get; set; } bool IsDivider { get; set; } bool IsHeader { get; set; } string Text { get; set; } string ContorllerName { get; set; } string ActionName { get; set; } string AlternateUrl { get; set; } bool OpenNewWindow { get; set; } IEnumerable < INavData > Children { get; set; } } |
Create…