.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Complex UI logic

Posted By:      Posted Date: October 01, 2010    Points: 0   Category :ASP.Net

Let's say we have a pretty  complex MVC application with many fields and business logic to be embedded in a view (eventually). For instance, let's say we have tens of fields to display (in a single view), which many of them can be enabled or disabled based on various conditions. Or even some fields may be hidden or displayed with a different type control (just text instead of a HTML control). All these rules may be based on data (values in some fields) and/or roles of current user.

My question would be how can somebody implement all these in MVC spirit?

Yes, we can have in model for all fields some extra properties which will tell us if that specific field needs to be enabled or disabled or hidden completly, or displayed as just text instead of different control, and then in view check these properties when displayed the field. (just that this require some consistent work when you have a lot of fields)

Something like (pseudocode) this for each field


if(model.Field1Visible)  {

  if(model.Field1Text) { %>

<%: Html.LabelFor(m => model.Field1) %>

  <% } else { %>

<%: Html.TextBoxFor(model => model.Field1, new {disabled = model.Field1Disabled} )%>

<% }

} %>

Creating separate views based on some conditions (let's say per

View Complete Post

More Related Resource Links

MDX query performance is slow for complex logic implementation in Calculated Members.

We have implemented a calculated members which involves multiple calculated members  called in a nested e.q. Cal1 calls Cal2 and Cal2 calls  Cal3  and Cal3 calls Cal4 .  And when browing Cal1 through Excel it takes around 30 mins for getting result from a Partition having row count around 5 million. Follwing are the information on the scenario I am having: We are having partitioning in the cube. one partition contains around 4-6 million records Processers on Query Server: 4 quad core RAM on the Query Server: 64 GB Calculated members having simple calculation logics are giving results in no time. There is a Calculated members which calls 6 intermediate calculated in nested way and with small Data Set like 5-6 k rows it is running fine.   Any help will be much appreciated.   Regards, Sandeep

Logic behind N -Tier Application Development

In the arena of application development, developers all over the world use various programming languages, technical processes, and technical tools. While using number of technical & non technical elements the processes or methods become complex, for simplification of the application development process, developers use various techniques such as dividing the application architecture into layers or parts. In the professional & technical language this separation or division process is called N-Tier Application Development process, where "N" stands for number and "tire" stands for layers or parts.

MVC too complex?


I believe lot of people will disagree with me on this one. But the MVC model sucks. The reason:

1.       Over complicated;

2.       Cannot handle complex UI;

3.       Hard to debugging as code scattered all over the place.

Pattern for huge logic



I am looking for a pattern/way to code for implement Huge logical hierarchy, Basically this is to verify person details like qualification, experience, expertised-in and global region.... and issue certain access for a perion of time.

The verification process has huge number of conditions it took around 1 year to document. And now we have to develop C# to implement it, can any one help me...? a sample code will be appreciated.

Thank you


How do I persist custom complex types in design-time


Let's say that I've got one custom webcontrol called MyControl.

public partial class MyControl: WebControl {
public IComplex Complex { get; set; }

The control is a very simple control but it holds an instance of a complex type that is accessable through a property. The property has the propertytype IComplex

public interface IComplex {
string Name { get; set; }
List<IComplex> Children {get;}

Let's say that I am able to pick one of several different types of object that derives from IComplex in design-time and assign it to the controls property "Complex" property.

Naturally I would like to persist this information to the HTML-View in a user-friendly way.

Because we don't know what type the user has picked there is no way to instansiate the type if we don't persist the name of that type. The Type could also contain more properties than the Interface the controls property is refering.

<cc1:MyControl id="MyControl1" runat="server">
<Complex> <!-

Logic to calculate business hours


Hi All,

I have tried searching all over the web for this logic. Got many but half of them did not match what i was looking for and half were malfunctioning.

I want to calculate business working hours between 2 datetime, where in I should be able to set the working hours as well as weekends and holidays should not be calculated.


Please help me guys... It will be a great help... 

Input Validation: Enforcing Complex Business Data Rules with WPF


Windows Presentation Foundation has a rich data binding system that includes flexible support for business data validation. We take a look at implementing some complex data input validation scenarios that include customized data errors for users.

Brian Noyes

MSDN Magazine June 2010

Text Rendering: Build World-Ready Apps Using Complex Scripts In Windows Forms Controls


The System.Windows.Forms.TextRenderer class provides support for complex scripts in Windows Forms controls so you can render text the way you want and support international locales.

Miguel A. Lacouture

MSDN Magazine March 2006

Super Complex Table/Matrix



I'm in a situation where I have to build a super complex table or rather matrix

This is how the table/matrix should look like: 




The complex thing is that everything is taken from a database.


I will try to explain the color sections one by one.


SERIE (Green area)

If we start with the top columns; SERIE 1, SERIE 2, SERIE 3

These values are coming from a table column value. If this column has the value 3 then I will need to print 3 table cells, just like in the image.




Then there is the outer left columns, that goes like this;

Behandlingsdag (meaning day of treatment)

Osplatin (100 mg/m2)

Leucovorin (x)

And so forth.


All these values are also coming from 3 different tables



One Column (Yellow area)

These cells are getting their values from a table. According to some true og false values.



1, 2, 3, 4 (Red area)

Then there is the table cells below the SERIES. These table cells goes like this

First there is a 1, then there are the tables cells 1 to 18 all below

Executing Command Logic in a View Model

Through the use of the Windows Presentation Foundation's (WPF) advanced data-binding capabilities, the logical structure of a user interface can relatively easily be disconnected from its presentation. Bindable components can now contain nearly all of an application's user interface logic and in most circumstances, replace the need for controller objects from the classic Model-View-Controller (MVC) pattern. So it's no wonder that a new pattern for UI design has appeared

Binding of complex entity turns into validation error

consider classic example: Product and Category editing Product in dropdown Id of Category is selected - Category mapped as object with all fields empty except Id when submitting Product edit form - validation gives an error: "Category name is required" (I have Required attribute on Category Name property) How deal with such errors if I want to use built-in validation (if (!ModelState.IsValid))? Writing custom data binder which would fill all such id-only-objects with values from database comes to mind.upd: I did small research of mvc code and found out that validation happens before binding - so this solution would't work. Do you have any other solutions for this problem?

count by casetypes with some logic

I have this query which displays all the SpecimenTypeNames for all our cases for a ComponentID. SELECT APVX.DOS.SpecimenType.SpecimenTypeName      FROM         APVX.ORDERS.ComponentOrder INNER JOIN                       APVX.ORDERS.ApCase INNER JOIN                       APVX.ORDERS.TestOrder ON APVX.ORDERS.ApCase.CaseID = APVX.ORDERS.TestOrder.CaseID INNER JOIN                       APVX.ORDERS.TestOrderSpecimen ON APVX.ORDERS.TestOrder.TestOrderID = APVX.ORDERS.TestOrderSpecimen.TestOrderID INNER JOIN                       APVX.ORDERS.Specimen ON APVX.ORDERS.TestOrderSpecimen.SpecimenID = APVX.ORDERS.Specimen.SpecimenID ON                       APVX.ORDERS.ComponentOrder.TestOrderID = APVX.ORDERS.TestOrder.TestOrderID INNER JOIN            &

Joining complex SQL tables

Hi, I am new to SQL query. I would like to join two SQL queries (MS Office Query and Computer Details Quer) into one. The tables output can be found at http://rapidshare.com/files/412281201/SQL_query.zip Or, from lsoon3@gmail.com Thanks for your guidance, below are the query:  1) MS Office Query: ================ select v_Add_Remove_Programs.DisplayName0 AS [MS Office Edition] from v_Add_Remove_Programs where DisplayName0 like 'Microsoft Office Project Professional%' OR DisplayName0 like 'Microsoft Office Visio Standard%' OR DisplayName0 like'Microsoft Office Visio Professional%' OR DisplayName0 like 'Microsoft Office Enterprise%'OR DisplayName0 like 'Microsoft Office Standard%' OR DisplayName0 like 'Microsoft Office Professional%' 2) Computer Details Query: ======================= select  distinct  v_R_System.ResourceID,  v_R_System.Netbios_Name0 AS [Computer Name],  v_R_System.Resource_Domain_OR_Workgr0 AS [Domain/Workgroup],  v_Site.SiteName as [SMS Site Name],  [Top Console User] = CASE  when (v_GS_SYSTEM_CONSOLE_USAGE_MAXGROUP.TopConsoleUser0 is NULL or v_GS_SYSTEM_CONSOLE_USAGE_MAXGROUP.TopConsoleUser0 = '-1')  then 'Unknown'  Else v_GS_SYSTEM_CONSOLE_USAGE_MAXGROUP.TopConsoleUser0  End,  v_GS_OPERATING_SYSTEM.Caption0 AS [Operating System],  v_GS_OPERATING_SYSTEM.CSDVers

How to debug a complex function?

Hi everybody, I got a few complex functions written by my colleague to review. These functions calculate cost of goods using one of the methods (passed as a parameter) (FIFO, RWAC, LAST cost). I've been looking at these functions or running some queries based on these functions, but I'm yet not sure I understand them fully and their logic. What is the best approach for me to test / understand these functions? Thanks in advance.Premature optimization is the root of all evil in programming. (c) by Donald Knuth Naomi Nosonovsky, Sr. Programmer-Analyst My blog

Writing Complex XML from DataSet

How can i use Dataset.WriteXml to write complex xml correctly?   I have an XSD.  i am adding data to the different tables inside of it. When i run the Dataset.writexml and store it to a location, the xml looks like this? - <Envelope>   <Username>****</Username>   <Password>****</Password>   <ClientVersion>2.1</ClientVersion>   <ClientTrackNum>3298509321744</ClientTrackNum>   <SessionId>4J023JMCASOR923KCM23AS24FV</SessionId>   </Envelope> - <DocGenBy>   <ProductName>M.Key</ProductName>   <ProductType>M.Key</ProductType>   <ProductVersion>M.Key</ProductVersion>   </DocGenBy> - <StoreInfo>   <Id>231</Id>   <Technician>tp1</Technician>   </StoreInfo>     When i run Dataset.writexmlSchema it writes the schema correctly.   - <xs:element name="Envelope"> - <xs:complexType> - <xs:sequence>   <xs:element name="Username" type="xs:string" minOccurs="0" />   <xs:element name="Password" type="xs:string" minOccurs="0" />   <xs:element name="ClientVersion" ty

General Controller to View logic question

Hello, I am currently learning the MVC2 Framework and I have a brief question in terms of my logic and if their are any flaws in it. I created a basic example in a couple of minutes that demonstrates the way I think about it. public ViewResult Index() { return View(); } public ViewResult Cookies() { return View(new Cookie()); } public ViewResult CookiesInput(Cookie cookie) { return View(cookie); }<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> <h2>I really like cookies</h2> Would you like a cookie? <% using (Html.BeginForm("Cookies", "Example")) { %> <p><input type="submit" value="Yes" /></p> <% } %> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> <h2>Cookies</h2> <% using (Html.BeginForm("CookiesInput", "Example")) { %> <%= Html.EditorForModel() %> <p><input type="submit" value="Gimme" /></p> <% } %> </asp:Content><asp:Content ID="Content2" ContentPlaceHolderID="MainConten

data contract code generation for large/complex schema (HR-XML/OAGIS) - is there an alternative?

Hello, and thank you for reading.I am implementing a Service based on a predefined specification (HR-XML 3.0). As such, I am starting with the schema, and working my way back to code. There are a number of large Schema documents (which import yet more Schema documents) related to my implementation, provided by this specification.I am able to generate code using xsd.exe, by supplying the "main" and "supporting" xsd files as arguments. But there are several issues, and I am wondering if this is the right approach.- there are litterally hundreds of classes - the code file is half a meg in size- duplicate classes (ex. Type, Type1 - which both represent the same type)- there are classes declared as inheriting from a base class, but that base class is not generated/definedI understand that there are limitations to the types of Schema supported by svcutil.exe/xsd.exe when targeting the DataContractSerializer and even XmlSerializer. My question is two-fold:1. Are code generation "issues" fairly common when dealing with larger, modular xsd files? Has anyone had success with generating data contracts from OAGIS or HR-XML schema?2. Given the above issues, are there better approaches to this task, avoiding generating code and working with concrete objects? Does it make better sence to read and compose a SOAP message directly, while sti
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend