Lance's Whiteboard

Random scribbling about C#, Javascript, Web Development, Architecture, and anything else that pops into my mind.

News


Creative Commons License
Lance's Whiteboard Blog by Lance Hunt is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
Based on a work at weblogs.asp.net



Sponsored Ad
Sponsored Ad

Blogs I Read

October 2007 - Posts

Manual CRUD operations with the Telerik RadGrid control

I have been working on a project lately that was already using the Telerik ASP.NET Rad Controls suite.  One of the new features was a fully editable web-grid, so I chose to use the existing ajax-enabled RadGrid control to speed my development.  I chose to use a 3rd party control, mostly due to time constraints since the project required a grid with inline-editing, full CRUD operations, plus custom column templates, all with heavy Ajax support to avoid postbacks and excessive page size.

I soon discovered, the Telerik controls are nice tool for simple uses where you can use asp.net DataSource controls and automatic databinding, but not so much if you need to get "fancy" with your implementation.  In my case I needed to do 2 things that cross over into the grey area where these controls excel.

First, I'm using an early 2.0 version of NetTiers for the DAL (with Service Layer implementation) with custom mods to the entities as the datasource,  and second, I'm doing some aggregate custom ItemTemplates that require custom data-binding.

This lead to extreme complexity in the implementation because, A) this version of NetTiers' had problems with properly generating CRUD operations for its EntityDataSource controls (NetTiers entities mapped onto a custom ObjectDataSource style control) which prevented me from using the declarative model, and B) the RadGrid control simply sucks if you cannot use automatic databinding and if you require custom databinding logic.

It would be great if I could upgrade NetTiers and/or Teleriki RadControls to the latest versions, but it wasnt possible in this situation, nor is it likely that this would have solved my problems.

Anyhow, all this discussion is basically just to share you this one link to a user-contributed example I found incredibly useful after 3 days of searching their forums, demos, and 3rd party blogs.   This example shows how to manually implement Insert/Update/Delete functionality within the RadGrid control by handling the events OnNeedDataSourceOnItemCommand, OnInsertCommand, OnUpdateCommand, and OnDeleteCommand:

http://www.telerik.com/community/code-library/subm...

The reason this link is important is because the Telerik website, with all of its dozens of examples, consistently shows very basic scenarios, even in samples labeled "advanced".  Also, not all of the API features are fully or well documented to help you figure this out on your own.

Hopefully this simple link (which should be promoted to Telerik's demos/samples page) will help someone else as much as it did me.

Posted: Oct 17 2007, 10:33 AM by CodeSniper | with 3 comment(s)
Filed under:
VPC 2007 Dual Monitor support

I have been trying to find a way to allow you to run Virtual PC 2007 with multiple monitors.  Natively VPC 2007 doesnt support more than 1 monitor, however you can "trick" it by using various techniques that expand the desktop area into a larger virtual desktop.

I tried using the awesome which can extend your screen across separate PC's (think "push" remote desktop), but the new multi-monitor compatibility feature of VPC 2007 (which inexplicably does not add multi-monitor support) made this difficult since it ensures that your desktop recaptures your mouse when you move it outside of the VPC window thus preventing the extended screen from being accessible.

So, instead I tried the Remote Desktop approach mentioned in Steven Harman's blog post.  

Here is a quick rundown on how it works:

Connect 2 monitors to your PC (more than 2 typically don't work with this approach).   Make sure to extend your desktop onto the 2nd screen via Display Properties -> Settings.  Then launch Remote Desktop (mstsc.exe) with the "/span" flag:

mstsc /span

Then just use Remote Desktop as usual by specifying your VPC's computer name in the connection dialog.

When I first tried this, it still didnt work exactly right.  It kept giving me annoying scrollbars instead of going full screen, so I added this extra flag to force it into fullscreen:

mstsc /span /f

Also, since I didnt want VPC to have the extra overhead of maintaining 2 sessions (the console and my new RDP session), I threw in one more flag to make it simply take-over the initial console window:

mstsc /span /f /console

NOTE: The /span flag is only present on the very latest version of Remote Desktop Connection.  Therefore, you must either be running Vista on both PC's, or install the update specified here:

http://support.microsoft.com/kb/925876

There are limitations on how your  monitors must be configured in order for this flag to work.

Also, keep in mind that this technique only enlarges your desktop area sufficiently large enouch to span both monitors, but it DOES NOT behave exactly like the native dual-monitor support you may be accustomed to.  For example, when you maximize a window, it maximizes across BOTH monitors instead of maximizing within the confines of a single monitor.   For now, I'm just dealing with that by avoiding maximizing and just manually resizing windows to fit 1 screen.

 

Advanced Users:

One way to avoid having to arrange windows each time is to use a cryptic, yet incredible tool called Hawkeye ShellInit. ShellInit is a small application that helps you manipulate your desktop & application windows via script.   Here is a small script that will move Visual Studio over the right-hand screen (assuming 1280x1024 resolution) and enlarge it to the correct size.

Position Window, *Microsoft Visual Studio, wndclass_desked_gsk, 1280, 0, 1288, 1002

If you decide to use this tool, make sure and read the readme.txt file for some good sample scripts and ideas.

More Posts