As you know MVC is a Model View Controller Pattern. which focus on the controller to update the view trigger by event when model changed/ updated.
MVP is the variation of MVC where controller can hang together with View (Called Presenter).
This makes the UI more interactive. such as in Asp.net control, user can interact with the model interactively using the presenter.
Passive view is also the variation of both. It will enhance the testability. It does not have dependencies with View and Controller and all user responses are handled by the controller
Wednesday, February 6, 2008
Free sorting with CSS Friendly and Object Datasource
I just find a good article where you can implement sorting and paging easily using object data source.
Object data source will not do binding everytime postback anymore and It instantiate inside your page control.
http://damianpedwards.spaces.live.com/blog/cns!A079DE667E1958B3!567.entry#post
All the presentation is implemented using CSS Friendly.
http://damianpedwards.spaces.live.com/blog/cns!A079DE667E1958B3!562.entry
Object data source will not do binding everytime postback anymore and It instantiate inside your page control.
http://damianpedwards.spaces.live.com/blog/cns!A079DE667E1958B3!567.entry#post
All the presentation is implemented using CSS Friendly.
http://damianpedwards.spaces.live.com/blog/cns!A079DE667E1958B3!562.entry
Tuesday, February 5, 2008
Trigger Javascript inside Ajax Partial Postback called
To run / trigger a javascript after ajax partial postback, We need to register our script in our code behind.
Here is the code :
//To find your script manager which belong to master pages
ScriptManager sm = Master.FindControl("ScriptManager1") as ScriptManager;
ScriptManager.RegisterStartupScript(this, this.GetType(), "title script", string.Format("javascript:window.open(\"{0}\",\"_blank\");", "kajaxnet.blogspot.com"), true);
Here is the code :
//To find your script manager which belong to master pages
ScriptManager sm = Master.FindControl("ScriptManager1") as ScriptManager;
ScriptManager.RegisterStartupScript(this, this.GetType(), "title script", string.Format("javascript:window.open(\"{0}\",\"_blank\");", "kajaxnet.blogspot.com"), true);
Monday, February 4, 2008
Dig into Data Source
Data Source (Object Data Source and Sql Data Source) in .net 2.0 includes free sorting and paging. Here is a very good example the benefit of using data source.
http://damianpedwards.spaces.live.com/blog/cns!A079DE667E1958B3!562.entry
Using Data Source we can use CSS friendly to structure and display our sorting and paging nicely.
However there is overhead when you implementing AJAX type of work.
http://damianpedwards.spaces.live.com/blog/cns!A079DE667E1958B3!562.entry
Using Data Source we can use CSS friendly to structure and display our sorting and paging nicely.
However there is overhead when you implementing AJAX type of work.
- DataSource will trigger your select method, everytime, it is postback.
If you use Data binding using data table / other data source , you can control manually so that it only bind when you need to refresh your data or there is data changes. - Object Data Source is isolated from your page control. because It create a new instance of data source every time it postback. so you can not share your data into your page control. If you want to share you need to share it using session/ cache. View state/ class variable can not be shared.
Dynamically sorting your data easily using Linq & Lamda
Here is 1 line of code to sort data dynamically based on sorting parameter A
YourProducts.OrderByDescending(p => p.GetType().GetProperty(A.GetValue(c,null))
It will get your property value of Product class dynamically.
Here are some example to use lamda expression in C# 3.0:
YourProducts.OrderByDescending(p => p.GetType().GetProperty(A.GetValue(c,null))
It will get your property value of Product class dynamically.
Here are some example to use lamda expression in C# 3.0:
x => x + 1 // Implicitly typed, expression body
x => { return x + 1; } // Implicitly typed, statement body
(int x) => x + 1 // Explicitly typed, expression body
(int x) => { return x + 1; } // Explicitly typed, statement body
(x, y) => x * y // Multiple parameters
() => Console.WriteLine() // No parametersSunday, February 3, 2008
TFS vs Others
Here is some of the features that I found in TFS but not in other version controls (CVS and SVN)
- Rename - It will automatically rename your file without removing from CVS / SVN.
Probably, Visual SVN also has this feature, But I never test it. - When Adding a project into source controls, It will efficiently exclude the bin folder and other files that will dynamically created. This will make source control very efficient. On the other hand, if using CVS/ SVN, you need to exclude the bin folder manually.
TFS knows .net source files better than other source control. - TFS has integrated with VS nicely. more than Visual SVN.
- TFS has integrated with Development Pattern methodology such as MSF Agile and CMMI
More over you can add your custom development pattern and process. - It integrate with Sharepoint portal which enhance the functionality as document management and documentation process such as WIKI and Blogs.
TFS on VS 2008 Beta 2 - Adding a lost files
After playing around with TFS on VS 2008, I found a difficulties to add a new file which I have created outside VS 2008.
In another scenario may happen if you want to recover unintentionally delete and at the same time merge with the previous version.
Somehow, It displays an error after I merge my lost file which says that I need to choose the server version or my version. But I does not have an option to do that.
However after fiddling with it for 1 hour, Finally I found the easiest way to dealing with those issues.
In another scenario may happen if you want to recover unintentionally delete and at the same time merge with the previous version.
Somehow, It displays an error after I merge my lost file which says that I need to choose the server version or my version. But I does not have an option to do that.
However after fiddling with it for 1 hour, Finally I found the easiest way to dealing with those issues.
- In source control , Right Click on directory which contains your new file or file that you want to recover.
- select Compare.
- TFS will list all new files or lost files and you can easily added into your source control.
Subscribe to:
Posts (Atom)