Proper Implementation Of MVP With Complex Controls?

Jan 20, 2010

I'm currently implementing a project using asp.net, c# and the MVP (Model-View-Presenter) pattern. The main purpose of this solution is to deliver a graph to the consumer, to be used by a variety of systems. It is basically a custom graph server.

The view page in this particular case has an MSChart control on it, which has to be dynamically populated and configured based on parameters in the QueryString. This can be as diverse as totally different types of data sets, display modes and so on, using a lot of the properties of the chart control.

Many of these properties are again of types which are particular to the chart control and would require the same dependencies as the chart control itself if they are to be set by the presenter.

I'm trying to figure out the best way to expose the properties to the presenter so it can work its magic.

Should I:

Just expose the whole chart object and live with a system.web type dependency in the presenter project? Make accessor and translation properties for all of the chart control properties so that I don't have the dependency, but add lots of complexity? Other, that I haven't thought of?

To me it seems that it would be against the MVP pattern to bubble a display control up into the presenter, but it seems that trying to map all the properties to DTOs or similar would be a lot of work that would add a lot of complexity, and while the solution would be somewhat more loosely coupled, I'm not sure the gain would be worth it in this case. How would you implement something like this, given MVP?

View 2 Replies


Similar Messages:

Architecture :: A Proper DI Implementation?

Feb 27, 2011

I'm fairly new to dependency injection but it seems like a proper DI implementation will be fairly complex.

For example, DI requires a centralized class that manages the configuration and resolves the dependencies at runtime.

DI is also based on the concept of using interfaces. For example, a SpecialLogger should use an ILogger interface.

The centralized DI manager class will need to register types - for example, associate ILogger to SpecialLogger.

SpecialLogger will also need to implement the ILogger interface so SpecialLogger can be used through the DI ILogger interface.

Therefore, it seems like a sln using DI will need multiple projects to support DI. Here is an example for logging:

* MyCompany.MyDivision.Framework.DI.Management - this would have the DI manager where dependency types are registered and resolved at runtime
* MyCompany.MyDivision.Framework.Logging - this would have the implementation of a logging class. The main logging class would need to implement ILogger.
* MyCompany.MyDivision.Framework.DI.Interfaces - this would have the ILogger interface.

Interfaces would need to be stored in a separate class library from the DI manager because both the DI manager and SpecialLogger use the ILogger interface. Since the DI manager associates SpecialLogger to ILogger a circular reference would be encountered without a separate class library to store the ILogger interface.

View 1 Replies

C# - Proper Implementation Of N-layer Architecture?

Feb 28, 2011

I have been learning C# for the last year or so and trying to incorporate best practices along the way. Between StackOverflow and other web resources, I thought I was on the right track to properly separating my concerns, but now I am having some doubts and want to make sure I am going down the right path before I convert my entire website over to this new architecture.

The current website is old ASP VBscript and has a existing database that is pretty ugly (no foreign keys and such) so at least for the first version in .NET I do not want to use and have to learn any ORM tools at this time.

I have the following items that are in separate namespaces and setup so that the UI layer can only see the DTOs and Business layers, and the Data layer can only be seen from the Business layer. Here is a simple example:

[Code]....

Am I completely off base? Should I also have the same properties in my BLL and not pass back DTOs to my UI? what is wrong and what is right. Keep in mind I am not a expert yet.

I would like to implement interfaces to my architecture, but I am still learning how to do that.

View 4 Replies

C# - Proper Implementation Of Nested API Calls Using Connection Pool And Nested Transactions?

Jan 4, 2010

I need to know the best way to do the following. I have nested business level APIs (say level 1 & level 2). L1 needs to call L2. Both APIs use the database layer directly at their own nesting levels.

Now, in the database layer, I fetch the db connection from the pool each time as follows:

SqlConnection conn = new SqlConnection(connString);
conn.Open();

Is it proper to fetch the db connection each time on every DB level call as above? I know it will return a connection from the ASP.NET connection pool. However, wouldn't it be better to maintain the same DB connection throughout the nested calls (or throughout the current http request lifetime)? Will fetching a connection from the pool each time cause issues with nested TransactionScopes?

View 1 Replies

Forms Data Controls :: Gridview Implementation?

Dec 6, 2010

i have to create a gridview on search button click. when user enter a name in the textbox then all the matching name will be displayed in the gridview at runtime , also it should have option to edit, delete ,update existing rows in gridview as well as new rows can be entered. thats why i have to append three buttons dynamically insert,edit and delete with each row of gridview..

View 6 Replies

MVC :: Proper Pattern For List Of Reusable Controls?

Aug 26, 2010

Say you have a for loop which renders a bunch of the exact same control. This is probably done with RenderAction or RenderPartial.

What is a way to ensure that each of these controls in the list gets wrapped in a div with a unique ID?

View 2 Replies

DataSource Controls :: Implementation Of A Find Method To Get Data From The Database

Mar 8, 2010

I'm using Postgresql/Npgsql in my asp.net application, so I can't use LINQ to SQL. I implemented the following method of User class:

[Code]...

View 1 Replies

Forms Data Controls :: Use The Controls Collection To Set The Proper MaxLength On The Textbox?

Nov 30, 2010

I want to set the proper MaxLength on the Textbox in the BoundField

How do I get the DataField from the ContainingField in order to know which field the column binds to (i.e., BoundField).

The Client-Side web form is located at [URL]

Sample snappet reads:

[Code]....

View 5 Replies

MVC :: Generate Proper Controls In View Based On The Model

Jan 24, 2011

it is possible to customize the typed view generation process to generate the proper controls based on the fields annotations of a model. For Example I have a Person Model that contains Foreign Keys like CityID,DepartmentID etc. So When i generate a view againt the Person Model it creates textbox's for all the Person fields but i want dropdownlists against FK fields. It Should be smart enough to at least geereate the peroper controls based on the Person's field annotations. How can i acheive that? Has anybody worked on that?

View 2 Replies

DataSource Controls :: Queries Not Returning Proper Data?

Mar 17, 2010

I am having trouble with queries because they are not returning the data needed, and I am having trouble figuring out why because I only am testing with 2 records.First I want a query to return all records for one customer as follows:

[Code]....

There are two records with the customerID of 1, but it only returns one,next I try to return only one record, the AccountPrimary or customer_contacts.IsPrimary, but when I add " AND customer_contacts.IsPrimary = 'True' "at the end of my query it then returns both records, but only one IsPrimary = True and the Other = False. Is it backwards? I also tried another method and it returned 30 of the same record and I only have 2

View 4 Replies

DataSource Controls :: Complex ObjectDataSource And ASP?

Apr 17, 2010

Consider a fairly complex business object. For the sake of discussion, let's think about a "ClassRoom" object - that will have some attributes which occur once, such as "capacity" and "area". It will also have some repeating attributes - perhaps "desks" which will itself be a collection of desk objects. The desk object will in turn have attributes such as "width" and "height".My example is more complex, but that should show where I am coming from. The business object, as you would expect, exposes methods to get the attributes in and out. There is also logic included to perform the underlying database updates. Of course, the necessary business validation is also in there.

In terms of binding to the ASP page, I will need to bind the attributes of "ClassRoom" to a set of fields on the page (using one method on the object). I will also want to bind the desks collection to a Repeater or GridView (using another method on the object).Presumably, I need to find a way to use a single instance of the ObjectDataSource so that the updates to the two (or more) disparate sets of data can be kept in step. I suspect that if I simply put two data sources on the page, I will get two instances and therefore no correlation between them.This can't be a unique problem, but I'm struggling to find any useful information.

View 3 Replies

Forms Data Controls :: What Would Be The Proper Format For A DropDownList Sender

Jan 14, 2011

I have a FormView with the ItemTemplate and InsertItemTemplate populated. In the InsertItem template, What I am trying to do is that when a user click on the DropDownList and selects the item from the list that they want, it Populates to a TextBox.

I have tried the SelectedIndexChanged event however It does not seem to fire the event.

My questions are;

What would be the proper format for a DropDownList Sender? e.g. I have tried this;

DropDownList ddlProjectYear = (DropDownList)sender;

What is the correct syntax for the FindControl? e.g. and I have tried this;

[Code]....

[Code]....

What would be the correct event that I should be using to have the SelectedValue of the DropDownList show up in the TextBox.Text?

View 5 Replies

DataSource Controls :: SQL Query With Complex Column?

Jun 14, 2010

I have following tables.

Items
ItemId
ItemName
GroupId
CatId
1
Apple
5
6
2
Banana
5
6
3
Blackberry
5
6
4
Grapes
5
6
5
Guavas
5
6
6
Beans fresh
5
7
7
Bitter Gourd
5
7
8................

View 7 Replies

Forms Data Controls :: Proper Multiline Text Handling In Listview?

Jun 21, 2010

In the edit template of the listview I have a multiline textbox. But when the row is edited and the template switches to the ItemTemplate, the text is not displaying properly in the associated Label control (missing linebreaks).

I know that the Label control doesn't understand the enter key code, and I need to do a replace on the string. What I have right now is :

[Code]....

View 1 Replies

Forms Data Controls :: Change Textbox To Proper Case Using Formview?

Feb 23, 2011

I have a Formview where students put their information in such as name, address, etc. The text boxes are bound to my database, so once they are done, they choose to update, and my database is updated with their information. My problem is that the students often use All Caps to enter in their information.

I think I need the StrConv somehow, but I just can't seem to get this done. I've seen where it could be done with text boxes, but not when they were in a Formview using parameters.

View 2 Replies

DataSource Controls :: Handle Coding A Proper DeleteMethod To Assign To ObjectDataSource

Jan 24, 2010

I currently have a gridview which I have populated using the following method:

[Code]....

What I am looking for is advice on how to handle coding a proper DeleteMethod to assign to my ObjectDataSource (via my class file). I have been searching through several forums, websites and other media and have been left a little confused. Everyone seems to have their own method, none of which I have been able to successfully adapt to my own needs. Here is some of the functionality that I am looking for:

1.) Delete item using Gridview's delete button

2.) Delete the record from both the datatable (and Gridview Row) and the database that the table was generated from.

3.) Upon deletion, refresh gridview

This may sound simple to many of you, but I need a little advice as to where to start. Any applicable threads, tutorials etc.

View 3 Replies

Forms Data Controls :: GridView Pager Not Showing Proper Number Of Rows?

Sep 9, 2010

I have created an out-of-the-box (default everything) ASP.NET Dynamic Data Entities Web Site using VS2010, C# and the .NET Framework 4. Created an ADO.NET Entity Data Model based off a MS SQL 2008 R2 database and registered that EF data model for my dynamic data. Everything works great except for the one change I would like to make. By default, the GridViewPager.ascx file provides the values 5, 10, 15 and 20 in the dropdown for GridView's "Results per page" option. I would like to change that to 10, 20, 30 and 40 - with 40 being the default selected option.

I went to the code behind file and modified it to have the values I am wanting. Those values now show in the dropdown, and work if I select them. Problem: when the page is first rendered only 10 rows will show. How can I change this?

View 3 Replies

DataSource Controls :: LINQ Mapping To Complex Business Objects?

Feb 5, 2010

I have two business objects mapped via LINQ to tables. One of the objects contains an instance of the other object and share a key as an identifier.I want to retrieve Class A and within class A all of Class B's values as well. What I am doing is this:

[Code]....

[Code]....

This seems a little clunky, as in slow. Is there a better way to get the Class B (User) information without making a query every time?

View 4 Replies

DataSource Controls :: Complex Paging Mechanism In Stored Procedure?

Jun 11, 2010

I want to have a paging mechanism. Its a bit hard to show all data and tables for this query but this is the current resulset.

As you can see Id has several duplicate entries (EventId as well but thats as its supposed to be):

Rownum EventID Id UserId

1 22 10 03088B17-36B2-425C-BD08-13E63AF07254
2 22 10 03088B17-36B2-425C-BD08-13E63AF07254
3 22 11 39E49E5A-7A42-43B6-882C-B22EE4C0922A
4 22 11 39E49E5A-7A42-43B6-882C-B22EE4C0922A
5 22 12 15C405BB-BD9A-4C6A-BF21-A95763FAD613
6 22 12 15C405BB-BD9A-4C6A-BF21-A95763FAD613
7 22 13 15C405BB-BD9A-4C6A-BF21-A95763FAD613
8 22 13 15C405BB-BD9A-4C6A-BF21-A95763FAD613
9 22 15 00000000-0000-0000-0000-000000000000
10 22 15 00000000-0000-0000-0000-000000000000

Now, I want to have paging and I'm doing that like this:

[code]...

In thew above query, when I leave out seltion of the RowNum column (so instead having: "SELECT distinct eventid,id,userid FROM") only 3 records are shown when I have a maximum pagesize of 5 passed to the @maximumRows variable.

What can I do to have exactly 5 records shown?

View 6 Replies

DataSource Controls :: Binding A Complex Query To A Data Control?

Apr 21, 2010

I'm trying to implement a recipe search page that allows users to specify search criteria by selecting checkboxes that match desired recipe attributes. All the data is stored in a database uing tables with 1 - many relationships. Each recipe can have multiple attributes from any of 5 attribute tables. I want to find all the recipes that match the user-selected criteria and display them in a grid. For example, the user may want a breakfast (attribute 1) recipe that is made with fruit and milk (attributes 2 and 3), is low-fat and high fiber (attributes 4 and 5), and takes less than 15 minutes to prepare (attribute 6). The query for this example might look something like:

SELECT distinct recipes.name, recipes.difficulty, recipes.preptime, recipes.cooktime

FROM recipes, recipeMeals, recipeDishes, recipeFoodGrps, recipeNutrients, recipeFixTimes

WHERE recipes.id = recipeMeals.recipeId and recipes.id = recipeDishes.recipeId and recipes.id = recipeFoodGrps.recipeId and recipes.id = recipeNutrients.recipeId and recipes.id = recipeFixTimes.recipeId and recipeMeals.mealId in (1) and
recipeDishes.dishId in (5) and recipeFoodGrps.fdGrpId in (1, 6) and recipeNutrients.nutrAttsId in (2, 3) and recipeFixTimes.fixTimeId in (1)

I' can generate the SQL but can't figure out how to bind it to a grid control. No could I see how to get any of the data controls to build the query for me. Is there a way to say "execute this query and display the results in a GridView"?

View 4 Replies

Forms Data Controls :: Binding Complex Property To Gridview Columns?

Oct 15, 2010

We know that using something like Bind("CustomerName") can be used in the Text property of a label control inside a gridview, where CustomerName is a property of the object whose collection is bound to the gridview. If that property is of a complex type (object of another class), how do we use a property of that inline object as a binding for the gridview column?

View 3 Replies

Forms Data Controls :: "Edit In Datasheet" Implementation In Asp

Apr 6, 2010

if you are familiar with the " Edit In DataSheet " Feature Provided by sharepoint site to edit a Table of data in spreadsheet. i want to do the same functionality in my asp.net application, so is there any feasible way to implement this. In Brief what i want to do.

1.Data will be displayed in my Page, using Grid, List, HTML Table or by any means but in tabular format.
2.when i want to edit any value from that table , thr must be some feature or button to command like "Edit in datasheet"
3. After Edit In Datasheet Button clicked, User will see Table values in Editable format, from where he can change/add/Insert values. this i want similar to access Form if you know/sha5repoint site feature of editing table. i think this is all might have clarified my requirement. up-date me if you have implemented a sort of functionalities or any idea abt this.

View 1 Replies

MVC :: Less Aggresive Implementation?

Jan 11, 2010

I like this idea when I don't have to use slow expression compilation to be strongly typed. But the current implementation is too aggresive for me - I hate virtualization my action methods.My question is: Are you planning some (branch) implementation that will not require action method virtualization? I think that most of code could be shared in both branches...

View 2 Replies

SSO Implementation Between OBIEE?

Aug 11, 2010

We have application build in asp.net in which on button we need to go to OBIEE dashboard. Similarly need to come back from OBIEE to ASP.NET application.

Currently I am using redirecting from ASP.net page to OBIEE with username and password in the URL. But as per my requirement i need to implement SSO or username and password should not be passed in URL query string.

View 1 Replies

How To Do Custom Bind() Implementation

Nov 27, 2010

When using a databound control the Bind() method does some magic to first extract the current value from the datasource and then pass an update back to the datasouce when an update is performed.

Now I have created a custom datasource and am supplying my own custom data which all works fine. For read only the following code works a treat. As you can see I am accessing both a named index into the collection and a property.

Now when using Bind() I cannot find a way to accomplish this. Bind() would appear to look for either an object property or a database row column (not sure how it does this) and I cannot find a way to change this.

It shouldn't be that difficult because the hard part is obtaining the data, which my code below can already do. The changes are passed back as a dictionary which should be simple. But I need a way to write my own bind method and I haven't managed to find out how.

Code:

Surname : <asp:TextBox ID="TextBox2" Text='<%#((MyCustomDataRow)Container.DataItem)["Surname"].EditDataString%>' runat="server" />

View 10 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved