I am not changing any organizational strucutre.If you follow my instructions from original question, everything is wherever prjoect create by default. All I am doing is that I am creating a new area, but not any custom location. Its wherever VS created by default. The only thing is that its been called by framework itself as I am just applying an attribute and not any Html.XXXX() call.
imak
Posts
-
MVC 3 Areas for code organization giving headaches -
MVC 3 Areas for code organization giving headachesI have tried changing the path in web.config for loginUrl attribute but didn't had any luck. It just keep complaining about access issues whenever I direct it outside ~\View folder. As for @Html.ActionLink, I am not sure where to force it. Because re-direction to Logon page is happening due to fact that I have decorated my HomeController with Authorize attribute and therefore there is no @Html.ActionLink involved.
-
MVC 3 Areas for code organization giving headachesQuestion is described by the steps below. 1.Create a new ASP.NET MVC3 Web Application using Internet Application Template. 2.Decorate HomeController class with Authorize. 3.Run the application, It basically takes you http://localhost: 51578/Account/LogOn?ReturnUrl=%2F Everything good so far. Let’s customize a couple of things in this project. 1.Add an area named “Login” in this solution and move AccountController.cs, AccountModel.cs and whole Account folder under Viewer into appropriate folder under this Area named Login. 2.Run the application now and you will get following error Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.InvalidOperationException: The view 'LogOn' or its master was not found or no view engine supports the searched locations. The following locations were searched: ~/Views/Account/LogOn.aspx ~/Views/Account/LogOn.ascx ~/Views/Shared/LogOn.aspx ~/Views/Shared/LogOn.ascx ~/Views/Account/LogOn.cshtml ~/Views/Account/LogOn.vbhtml ~/Views/Shared/LogOn.cshtml ~/Views/Shared/LogOn.vbhtml Do I need to modify anything in the web.config or in routing to make this work?
-
i am asking for answers and not lectures from you guysRichard MacCutchan wrote: Then add the extra information to your original question, do not delete it and start a new thread. just read the information provided to get that extra info
-
i am asking for answers and not lectures from you guysI am iterating through all properties for all controls on that form but the properites related to extendercontrol just not dispalyed here, although when I go to Visual stuio designer, these propeties are showing up for each individual control within that form and I am just wondering if there is something wrong I am doing with reflection code.
ControlCollection Controls = (ControlCollection)this.Controls;
foreach (Control ctl in Controls)
{
Type t = ctl.GetType();PropertyInfo\[\] PIs = t.GetProperties(); foreach (PropertyInfo PI in PIs) { Console.WriteLine(PI.Name); } }
-
i am asking for answers and not lectures from you guysforget about this forum to get any help; its useless
-
Read winform control properties via reflectionI have an assembly that contains several winforms which itself contains several controls. I want to dynamically get list of controls on all the web forms in assemly and then check certain properties on each control. Is it doable via refelction? If so can you please post some example code?
-
Reflection - Dynamically invoking propertyGot it, Thanks all for your help
-
Reflection - dynamically adding custom attributesIs it possible to dynamically adding custom attributes to class methods or properties? If so any examples will be appreciated.
-
Reflection - Dynamically invoking propertyWhat should be the obj in this case?
-
Reflection - Dynamically invoking propertyI get following error now Form1 is a 'type' but is used like a 'variable'
-
Reflection - Dynamically invoking propertyMy class exposes some controls via properties. I need to invoke certain properties of these controls that are decorated with my custom attributes. So let’s take example. Here is how my class look like public partial class Form1 : Form { public Control Button1 { get { return this.btn1; } } [MyCustomAttributes] public Control Button2 { get { return this.btn2; } } } Now I want to dyanmically call Visible property to false on the Control properties that are decorated with MyCustomAttributes attribute. PropertyInfo[] PI = typeof(Form1).GetProperties(); foreach (PropertyInfo property in PI) { MyCustomAttributes myAtt = (MyCustomAttributes)Attribute.GetCustomAttribute(property, typeof(MyCustomAttributes)); if (myAtt == null) continue; property.SetValue("Visible", false, null); } But I get exception that "Property set method not found". Any ideas what I am doing wrong here?
-
Application Security - Design QuestionMy company has a winform application with hundreds of forms. The application is close to be released and management now want us to add application level security in it. So basically things like a user X in role Y can do certain things but should not be able to do other things. We cannot reply on the fact that all our clients will have windows domain. My initial thought about its design is to have some kind of mapping in terms of UI elements in different forms and then make these UI elements read-only based on permissions. Just wondering if there are any patterns of implementing it and if anyone can point me to links for it? I have looked at Security Application Block in Micorosoft Enterprise Library and seem like it can be used for authenticating the users but its probably problematic if you are not on Active Directory (correct me if I am worng here)?
-
Linq - how to write code for this queryThanks Mehroz for your reply. I know that's what I need to do in the inner query. If you see my code, I am able to extract latest record group, however after that this inner query need to do a join with #test table. That's exactly where I am having difficult of how to join result of grouping to this #test table. That's where I need help.
-
Linq - how to write code for this queryHi I am a new bie to Linq and trying to convert having code in C# for following.
CREATE TABLE #test
(
Name VARCHAR(100) NOT NULL,
ServiceDate DATETIME2 NOT NULL,
MinValue INT,
MaxValue INT
)INSERT INTO #test (Name, ServiceDate, MinValue, MaxValue) VALUES ( 'Foo1', '2009-05-01', 11, 12)
INSERT INTO #test (Name, ServiceDate, MinValue, MaxValue) VALUES ( 'Foo1', '2008-04-02', 10, 13)
INSERT INTO #test (Name, ServiceDate, MinValue, MaxValue) VALUES ( 'Foo1', '2010-01-05', NULL, NULL)
INSERT INTO #test (Name, ServiceDate, MinValue, MaxValue) VALUES ( 'Foo2', '2001-11-03', 23, 87)SELECT A.*
FROM #test A
JOIN
(
SELECT Name, MAX(ServiceDate) ServiceDate
FROM #test
WHERE MinValue IS NOT NULL AND MaxValue IS NOT NULL
GROUP BY Name
) B
ON A.Name = B.Name AND A.ServiceDate = B.ServiceDateThe contents of #test table are available in DataTable dt. This is what I got so far, which basically give me the inner table with grouping, not sure what need to be done to join it to the outer table.
var query = from row in dt.AsEnumerable()
where row.Field("MinValue") != null && row.Field("MaxValue") != null
group row by row.Field(Name) into grp
orderby grp.Key
select new
{
Name = grp.Key,
ServiceDate = grp.Max(r => r.Field(ServiceData)),
};Any help will be highly appreciated. TIA
-
deleted DataRows just vanishes from DataTable, no way to access themGot it, was missing AcceptChanges()
-
deleted DataRows just vanishes from DataTable, no way to access themI have this test code where I can see the same behavior. Can someone point what am I doing wrong here? static void Main(string[] args) { DataTable table = new DataTable(); DataColumn col = new DataColumn("ID", System.Type.GetType("System.Int32")); table.Columns.Add(col); for (int i = 0; i < 10; i++) { DataRow row = table.NewRow(); row["ID"] = i; table.Rows.Add(row); } Console.WriteLine(table.Rows.Count); for (int i = 0; i < table.Rows.Count;i++ ) { if (Convert.ToInt32(table.Rows[i]["ID"]) == 4) { table.Rows[i].Delete(); break; } } Console.WriteLine(table.Rows.Count); DataTable deletedRows = table.GetChanges(DataRowState.Deleted); // This returns NULL, shouldn't it have one row here??? for (int i = 0; i < deletedRows.Rows.Count; i++) { Console.WriteLine("Deleted: " + deletedRows.Rows[i]["ID",DataRowVersion.Original].ToString()); } }
-
deleted DataRows just vanishes from DataTable, no way to access themI have a datatable that acts as a DataSource for control. Programmatically I am also deleting some rows from this table using code like foreach (DataRow row in myDataTable.Rows) { if (row["Id"].ToString().CompareTo(myControl.SelectedValue.ToString()) == 0) { row.Delete(); break; } } I am not calling AcceptChanges on datatable. However after this delete, I don’t see any rows that have a status DataViewRowState.Deleted Any ideas what I may be missing?
-
Add item to a listbox that is bind to a DataSourceGot it. Its working for me now. Thanks for your help
-
Add item to a listbox that is bind to a DataSourceThanks for the reply. Problem is that my collection is actually an entity collection that is returning bunch of columns from table and I am just using one of the column to populate this listbox. I therefore not sure if I can add this item into the collection.