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


Top 5 Contributors of the Month
david stephan

Home >> Articles >> Windows Application >> Post New Resource Bookmark and Share   

 Subscribe to Articles

Bind WinGrid to obtain a card view layout - Infragistics

Posted By:Deepika Haridas       Posted Date: October 13, 2010    Points: 50    Category: Windows Application    URL: http://www.dotnetspark.com  

This code shows how to obtain a card view layout with the help of Infragistics WinGrid. WinGrid helps you to easily print and export your data.
 

This code shows how to obtain a card view layout with the help of Infragistics WinGrid. WinGrid helps you to easily print and export your data in the form of excel or PDF document.

1. Bind grid to a DataSource (Same as we do in usual Gridview)


2. Now we need to obtain a card view layout which can be achieved by properties of Displaylayout object

VB:
'You must set this property in order to print in card view.
Me.UltraGrid1.DisplayLayout.AllowCardPrinting = _
   Infragistics.Win.UltraWinGrid.AllowCardPrinting.RootBandOnly

'Display WinGrid in card view.
Me.UltraGrid1.DisplayLayout.Bands(0).CardView = True

'Set a caption for each card using the CompanyName field.
Me.UltraGrid1.DisplayLayout.Bands(0).CardSettings.CaptionField = "CompanyName"
C#:
//You must set this property in order to print in card view.
this.ultraGrid1.DisplayLayout.AllowCardPrinting = Infragistics.Win.UltraWinGrid.AllowCardPrinting.RootBandOnly;

//Display WinGrid in card view.
this.ultraGrid1.DisplayLayout.Bands[0].CardView = true;

//Set a caption for each card using the CompanyName field.
this.ultraGrid1.DisplayLayout.Bands[0].CardSettings.CaptionField = CompanyName";
3. To print cards (prin
t layout) you need to write code in InitializePrintPreview event
VB :
'Standard labels makes it easier for each card to stand on its own, allowing you 'to possibly cut out the cards for distribution.
e.PrintLayout.Bands(0).CardSettings.Style = _ Infragistics.Win.UltraWinGrid.CardStyle.StandardLabels

'Setting the MaxCardAreaCols and MaxCardAreaRows properties allow you to limit 'the amount of cards per page. Setting these properties to 3 will give you nine 'cards per page.
e.PrintLayout.Bands(0).CardSettings.MaxCardAreaCols = 3
e.PrintLayout.Bands(0).CardSettings.MaxCardAreaRows = 3

'Each card will automatically increase width in order to fit in the available space.
e.PrintLayout.Bands(0).CardSettings.AutoFit = True
C#:
//Standard labels makes it easier for each card to
//stand on its own, allowing you to possibly cut out the cards for distribution.
e.PrintLayout.Bands[0].CardSettings.Style = Infragistics.Win.UltraWinGrid.CardStyle.StandardLabels;

//Setting the MaxCardAreaCols and MaxCardAreaRows properties allow you to limit //the amount of cards per page. Setting these properties to 3 will give you nine //cards per page.
e.PrintLayout.Bands[0].CardSettings.MaxCardAreaCols = 3;
e.PrintLayout.Bands[0].CardSettings.MaxCardAreaRows = 3;

//Each card will automatically increase width in order to fit in the available space.
e.PrintLayout.Bands[0].CardSettings.AutoFit = true;

4. For print preview write this code on the button click event of Print Preview
VB :
'Calling the PrintPreview method displays WinGrid's print preview dialog box.
Me.UltraGrid1.PrintPreview()
C# :
//Calling the PrintPreview method displays WinGrid's print preview dialog box.
this.ultraGrid1.PrintPreview();


5. Now Run the application and you'll see the output in the form of card view.


6. Output on Print Preview




 Subscribe to Articles

     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

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