Here is a simple way to do the role based Authorization in your MVC4 Controllers using VB.NET IF you have a role called Client then simply add the following text on top of your each ActionResult( which displays the view) <Authorize(Roles:=”Client”)> See the following example. The Index View has been restricted and can only […]
In VB.NET Use tablControl1.SelectedTab = MyTabName In C# use tabControl1.SelectedTab = MyTabName; MytabName will automatically be displayed.
Could not load file or assembly ‘System.Web.Http.WebHost, Version=188.8.131.52, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies. The system cannot find the file specified.
Could not load file or assembly ‘System.Web.Http.WebHost, Version=184.108.40.206, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies. The system cannot find the file specified. Scenario I had a Visual Studio 2013 project using MVC4. The application was working fine in my local machine. But when I deployed the application using FileSystem( in this method all the […]
Installed the PagedList.MVC in your project using the NuGET This is the ASP.NET Syntax In your Controller Here At the top of the Controller add the following two imports Imports PagedList Imports PagedList.Mvc Here is a sample ViewResult Function NewVideos(Optional ByVal Page As Integer = 1) As ViewResult Dim videos = rep.GetNewVideos.ToPagedList(Page, 10) ‘ […]
Here is a small function to return the GUID. GUID stands for Globally Unique Identifiers. GUIDs are 128-bit globally unique identifiers and they are generated automatically based on close to two zillion frequently varying factors. It has extremely low possibility that a generated GUID would equal to another GUID. Function GenerateGUID() as string return System.Guid.NewGuid.ToString() […]
If you would like to hide the columnheaders of a datagridview in your winforms application then here is the code for that. ‘ This will hide all the column headers for your datagridview In VB.NET use this code DataGridView1.ColumnHeadersVisible = False In C# use the following code dataGridView1.ColumnHeadersVisible = false;
You start with a new project and you have created a winform with graphics and the functionality which you want to use in all your other forms in the same project. One would think that it is easily done as we can simply copy and paste the existing form and rename it and then suddenly […]
If you are trying to use the simplemembership in mvc4 in visual studio and if you get this error Invalid object name ‘dbo.UserProfile’ in mvc4 Here is a simple fix for this This error will come when your table owner is not dbo. Change the table ownership in SQL Server by using the following […]
In SQL you would use the following query to get the count of number of rows in a table. Select count(*) from tblMyData In LINQ In VB.NET you would use the following to get it Dim v = (From u In MyContext.MyTable).Count() In C# you would use the following […]