.Net, ASP.Net, C#, VB.net, SQL Server, Xml, CSS, Design Patterns related tips, tricks, code snippets, articles, links, thoughts, etc. from Binu & Subi Thayamkery.

Binu Thayamkery is a seasoned software architect with more than 13 years of experience in developing enterprise grade connected systems using Microsoft Technologies. In his current position as a lead consultant-solution architect with Prudential Financial, he is working on architecture of next generation investment reporting framework using .net 3.5/WCF/AJAX, etc. He holds a Masters Degree in Computer Science from Colorado State University. Subi Thayamkery is an experienced software developer with more than 8 years of developing various application software systems ranging from workflow automation systems to compliance management tools. She currently works as a technology consultant for Prudential Financial where she helps develop a new system for corportate governance department. She holds an Electrical Engineering degree from New Jersey Institute of Technology.

Showing posts with label Third-Party. Show all posts
Showing posts with label Third-Party. Show all posts

Thursday, June 01, 2006

Infragistics Net Advantage 2005 Vol 3 - Tips and Tricks - Part 1

1) For development, always install the complete product, dont try to copy the Infragistics assemblies script files manually to set up your dev machine. A proper install will make sure that the components are added to your VS.Net IDE toolbox. If your install fails to do this, there is a command line utilty provided (available from Infragistics Program Group) with the product that will add VS.Net toolbox tab.
If you are upgrading Infragistics from an older version to newer version, make sure to upgrade your project files using .Net Project Upgrade Utility (also found in Infragistics Program Group). Make sure that you have all the latest hot fixes applied (to avoid nasty surprises). A complete installation will also install
help files, regsiter them propery, it also comes with a nice Samples Browser with a lot of working samples.

2) First time when you starting your development with Infragistics, (for example UltraWebgrid), you set your references to the required assemblies, dragged the control on to your form and ran it. If you get a runtime error pointing to missing "BorderStyle" class/namespace reference, you probably need to set "CopyLocal" property for the WebUI assembly to True. To do this locate Infragistics.WebUI.Shared.v5.3, right click and Properies, set CopyLocal to true.

3) Infragistics provides you a very rich UI experience. How does it do it? It uses a mix of client side javascripting and server side programs. Infragistics comes with a neat collection of client side javascript library for each of its controls. This provides rich client side features. It is AJAX enabled, and makes out-of-band calls to server to load data when the control's properties are set to use that feature. When you intsall the product (example: Ver 2005 Vol 3)
you will notice that a virtual directory named "ig_common" is created for you. This virtual directory hosts the required javascript files and other resources that are required for running Infragistics controls.

4) Discussion of the previous point leads us to the deployment of applications that uses Infragistics, For a simple deployment follow these steps,

  • Copy the Infragistics Assemblies that are used by your application to a install folder in your server. These are signed assemblies. Add these to Global Assembly Cache (GAC).

  • Copy the directory that is pointed by ig_common virtual directory in your dev
  • Create a virtual directory in your server, point it to the folder explained in the previous step.

  • Build your application that uses Infragistics, deploy it to the server ( which ever way you choose, xcopy, copy project..)



5) Page.SmartNavigation - Set this to False from design view. I have seen many developers complaining about this feature in v1.1. Setting this property to true is not recommended (so I was told by Infragistics Support once!)when your page has Infragistics components. If you want to preserve the scroll position on your page use some Javascript technique.

6) UltraWebGrid - Simple Binding - Works pretty much the same way as a regular ASP.Net grid. Please remember that UltraWebgrid can have multiple bands (virtual grids within grid) and columns collection is within the Band. Another important property is DisplayLayout. Most of the UI elements are defined within this. If you are binding the grid on the fly relying on the underlying datasource for columns, Set DisplayLayout > AutoGenerateColumns to True. You can also choose to add columns design time, setting the data field names for each columns, in that case set AutoGenerateColumns to False.

Example:

myGrid.DataSource = myDataSet.Tables[0].DefaultView;
myGrid.DataBind();

Once the DataBind() is done, the grid fires "InitalizeLayout" event. This is one event you can hace code to handle some useful
properties of the grid. This can be a good place to handle setting the column widths, making some columns hidden, setting "keys"
for columns, turning on/off sorting for columns, handling header captions and style to name a few.


//Do not forget to import the namespace
using Infragistics.WebUI.UltraWebGrid;
using Infragistics.WebUI.Misc;
:
:
//Examples of setting keys for columns; you can use the key to grab handle to this column
myGrid.Bands[0].Columns[0].Key = "Check";
myGrid.Bands[0].Columns[1].Key = "Id";

//Setting Align
myGrid.Bands[0].Columns[0].CellStyle.HorizontalAlign = HorizontalAlign.Center;

//Setting width
myGrid.DisplayLayout.Bands[0].Columns[0].Width = Unit.Pixel(30);

//setting click action on header
myGrid.DisplayLayout.Bands[0].Columns[0].Header.ClickAction = HeaderClickAction.NotSet;

//Setting Header Caption
myGrid.DisplayLayout.Bands[0].Columns[0].Header.Caption = "My Caption";

//set sort for all bands and columns of the grid to "No Sort"
myGrid.DisplayLayout.HeaderClickActionDefault = HeaderClickAction.NotSet;



More coming sooon....

Tuesday, May 16, 2006

Attention!!! all Infragistics Net Advantage Users

If you are using Infragistics Net Advantage 2005 Vol3, get the latest Hot Fix on this version and apply it now! if you haven't done it yet. This hot fix is out there for a while now, but if you have purchased the product from one of those re-sellers, then the media they sent you do not have any hot fixes. Goto to www.infragistics.com, register your product and get the hot fixes!


This hot fix fixes at least couple of issues I have encountered,

  • Infragistics script library code (js code) going into indefinite loop resulting in your web server going toast! This happens when you are doing add/edits directly into the UltraWebgrid...When this happens your CPU just peaks to 100% all eaten by your iis process

  • Again, Utrawebgrid eating all the memory when it is heirarchial and paging is enabled..(I am not sure about the sequence to re-produce the error!!)



So....Apply the hot fix! and keep coding ;-)

Cheers!

Wednesday, February 15, 2006

.Net Framework Tools Part 2

Type Library Importer (TlbImp.exe) and Exporter (TlbExp.exe)
Type library importer imports the type library information for a COM components into equivalent definitions in command language runtime library. This is useful when you want to use your legacy COM components with your new .Net application (think COM Interop). If you are someone like me who uses Visual Studio.Net, you can do this by adding a reference to the COM components from your IDE. For others, sample usage is:

tlbimp myTLB.tlb /out:myNet.dll

For more information on this tool goto: http://msdn.microsoft.com/library/en-us/cptools/html/cpgrfTypeLibraryImporterTlbimpexe.asp

Type library exporter is opposite of importer, it is useful to create a type library for your .netr assembly. Again this is used in a COM interop scenario when your COM application (ex: your old VB 6.0 App) wants to use some new functionality that your developed using .Net ( I see this in lot of places where critical VB 6.0 apps still being used and new development moved to .net and this approach is usually part of the migration strategy)

Usage is:


tlbexp myNet.dll /out:myTLB.tlb

One important information to note here is that this tool creates the TLB but does not register it. For that you should use another tool (discussed next) , RegAsm.exe
For more information on this tool goto: http://msdn.microsoft.com/library/en-us/cptools/html/cpgrfTypeLibraryExporterTlbExpexe.asp

Assembly Registration Tool (RegAsm.exe)
This tool reads the metadata within the .net assembly and creates the necessary information within the registery so that a COM client can consume services of a .Net component. This tool can optionaly create a TLB also. Afer you register your assembly using this tool, you can install it into Global Assembly Cache also so that it can be activated from any client. How do we do it? Use GacUtil.exe which will be discussed next :)

Usage for RegAsm.exe:

regasm myNet.dll
or when you want to create a TLB, use
regasm myNet.dll /tlb:myTLB.tlb

For more information on this tool goto: http://msdn.microsoft.com/library/en-us/cptools/html/cpgrfAssemblyRegistrationToolRegasmexe.asp

Global Assembly Cache Tool (GacUtil.exe)
This tool is used to view and manipulate the contents of the Global Assembly Cache. Like we explained earlier, one use is to install new .net assembly into GAC. This can also be used to uninstall an assembly. Examples of simple usages are:

For install
gacutil /i myNet.dll


For uninstall
gacutil /u myNet.dll


For more information on the tool and its usage goto:http://msdn.microsoft.com/library/en-us/cptools/html/cpgrfGlobalAssemblyCacheUtilityGacutilexe.asp

WinZip command line and unzip script

Winzip provides a command line add-on that you can use if you have a licensed version of WinZip. (For download goto: http://www.winzip.com/prodpagecl.htm ) This comes very handly when you need to unzip files from your program. In my case, I wrote a small VB Script file (scheduled to run using my scheduler as part of a batch job) . Below given is the script. it unzips to a specified directory, uses WScript and Shell object.



Option Explicit
On Error Resume Next

Dim oArgs
Set oArgs = WScript.Arguments
if oArgs.Count <> 2 Then
WScript.Echo "Usage: zUnzip <ZIP FILENAME> <PATH TO UNZIP>"
WScript.Quit
End if

Dim ZipFileName
Dim PathName
ZipFileName = oArgs.Item(0)
PathName = oArgs.Item(1)

'Unzip given zip file to specified path
Dim objShell
Set objShell = WScript.CreateObject("WScript.Shell")
Dim cmdScript
cmdScript = "%comspec% /c wzunzip.exe " & ZipFileName & " " & PathName
objShell.Run(cmdScript), 1, True

WScript.Quit



Some points worth mentioning,

objShell.Run(cmdScript), 1, True

In this command, second parameter for the Run Method is window style, if it is 1 it shows a window, use 0 for not showing the command window
Also note %comspec% /c in the command, this variable gets you the command interpreter for your OS, for example for Win2K, it gives you "cmd" and /C switch closes the secondary session after execution.

Cheers!

Thursday, February 09, 2006

commenting and trackback have been added to this blog.