Answer by David Silva-Barrera for C# - Combining matching results from SQL...
You can't sum the meals'cause you will get a single number, but you can group by name column and get a table where meals are summarized:select user_id, name, sum(meals) from datatable group by user_id,...
View ArticleAnswer by David Silva-Barrera for How to use EditorFor inside a foreach
Is there any other reason (example apart) for explicitly using the foreach yourself? You could make a Custom Editor (or Display) helper for User class and make @Html.EditorFor(model=>model.Users)....
View ArticleAnswer by David Silva-Barrera for mvc dropdown binding for an int in razor view
Using ViewBag will work too:You have the property HoursToWait in your ViewModel. public class MyViewModel{ public int HoursToWait { get; set;}}...and in the Controller's GET method: var Values = new...
View ArticleAnswer by David Silva-Barrera for VisualStudio2010 Debugging - The process...
My problem started after creating a custom control and drag and drop it to the toolbox palette for use it in design forms. First appeared a warning saying that there was a redundance between the custom...
View ArticleAnswer by David Silva-Barrera for How can i set the html id attribute in razor
I just tested this solution with MVC5 .net 4.5.1. I was trying to set manually the form Id because I was going to have several forms in the same page and I needed to control then separatelly with JS...
View ArticleAnswer by David Silva-Barrera for Add border-bottom to table row
<td style="border-bottom-style: solid; border-bottom: thick dotted #ff0000; ">You can do the same to the whole row as well.There is border-bottom-style,...
View ArticleAnswer by David Silva-Barrera for EF6 - Is there a way to clear EF cache /...
I have been using SqlQuery from dbset for this purpose, this way:context.xdbset.SqlQuery("storedprocedure; select * from xdbset"); The query calls the stored procedure and then calls select *... which...
View ArticleAnswer by David Silva-Barrera for Build error: "The process cannot access the...
Just check the references and remove the self-reference to the project.Explanation: My problem started after creating a custom control and drag and drop it to the toolbox palette for use it in design...
View ArticleAnswer by David Silva-Barrera for Row Level Security with Entity Framework
I found a way to do it using Postgres and an Extension called Veil. It actually works (designed for) using Views for all operations (select, update,delete,insert) and verifying permissions in WHERE...
View ArticleAnswer by David Silva-Barrera for Deny Switching to Tabpage in a tabcontrol
You can use the Selecting event of the TabControl. It is of type: TabControlCancelEventHandler and it have a parameter of type TabControlCancelEventArgs with the attribute Cancel. private void...
View ArticleAnswer by David Silva-Barrera for Error: execution failed for task...
I got this log error (after PC restarted):Executing tasks: [:app:assembleDebug][Fatal Error] :1:1: Content is not allowed in prolog.:app:buildInfoDebugLoader FAILED:app:buildInfoGeneratorDebugThe...
View ArticleAnswer by David Silva-Barrera for C# ListView Column Width Auto
There is another useful method called AutoResizeColumn which allows you to auto size a specific column with the required parameter.You can call it like this:listview1.AutoResizeColumn(1,...
View ArticleAnswer by David Silva-Barrera for TabControl Context Menu
I was looking for a solution for the exact same problem.After testing both @nisar and @BFree answers I came to this (I also had the TabControl` inside a Panel somewhere in the Form):Create tabcontrol1...
View ArticleAnswer by David Silva-Barrera for Entity Framework 6 Error Unable to load the...
When you copy an EDMX from one project to another, you must be careful with the name of the folder where you originally created the EDMX, because it's reflected in the app.config (or web.config), in...
View ArticleAnswer by David Silva-Barrera for FileDescriptora Missing Characters
IntPtr fileDescriptorPointer = (IntPtr)((long)fileGroupDescriptorWPointer + Marshal.SizeOf(fileGroupDescriptorWPointer) - 4);fileDescriptorPointer = (IntPtr)((long)fileDescriptorPointer +...
View ArticleAnswer by David Silva-Barrera for Open DateTimePicker C# control...
I liked some of the previous ideas and finished with this (tested) Mix:public static class Extensions { public static void Open(this DateTimePicker obj) { obj.Select(); SendKeys.Send("%{DOWN}");...
View ArticleAnswer by David Silva-Barrera for How to add 'ON DELETE CASCADE' in ALTER...
As explained before:ALTER TABLE TABLENAMEdrop CONSTRAINT FK_CONSTRAINTNAME;ALTER TABLE TABLENAMEADD CONSTRAINT FK_CONSTRAINTNAME FOREIGN KEY (FId) REFERENCES OTHERTABLE (Id) ON DELETE CASCADE ON UPDATE...
View Article