Hello,
I am trying to resize the height of the row after binding it with a data source.
The row whose height need to be re-sized depends upon the content in it.
As shown in the image attached , Rows 1 & 2 in the Current & Future costs Grid need to be resized i.e Height changed so that the user sees the multi lines in the columns.
Now for columns with out multi line data I would like to position the data in the center of the column.
I wanted to know how this can be achieved.
Hoping for a quick reply.
Thanks,Ashwin
To auto-size the height of the rows, set UltraGrid.DisplayLayout.Override.RowSizing to one of the 'Auto' settings. To center-align cell content use the UltraGridColumn.CellAppearance.TextHAlign/TextVAlign properties.
Thanks for the quick reply Brian, Very much appreciated !
I tired what you said and seems to be working fine. Thank You.
I have one more problem, I am not sure if I need to submit a post or I should post it here itself. I think I will do both.
In the image that I posted earlier you can see a Disc# column which is of Style URL.
The underlying Datasource for the columns which display multiple values is of type string.
For the Disc# column of Style URL when I pass in a sting which is some thing like this
viewRow.DiscountNumber = cost.DiscountNumber + Environment.NewLine + Environment.NewLine + cost.RipHistory.DiscountNumber;
It seems to appear one below the other with out any new line ( I have attached a new image ) and the everything displayed in the column is considered as one URL and not two separate URLS.
Is there a way I can have multiple URLS displayed in a single cell ?
Thank you very much Mike!
I was able to the same thing before you posted this reply and again thanks to your earlier posts.
I really really appreciate your patience and your lengthy replies explaining everything in detail.
Thank you Sir!!!!
Hi,
The URL Style on the column treats the whole contents of the cell as a single URL. If you want mulitlple hyperlinks in the same cell, you have to do a bit more.
To make a cell show multiple hyperlinks, you need to use some custom Xml. To respond top clicks on this links, you will need an UltraFormattedTextEditor control.
So what you do is place a new UltraFormattedTextEditor control on the form with the grid. You will probably want to set this control's Visible property to false since there's no reason for the user to see it.
You hook this control up to the grid column using the EditorComponent property of the column. This replaces the setting of the Style property (so you should not set the Style property on the column). So, in a very simple example, your InitializeLayout code might look something like this:
private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e) { UltraGridLayout layout = e.Layout; UltraGridOverride ov = layout.Override; UltraGridBand band = layout.Bands[0]; ov.RowSizing = RowSizing.AutoFree; UltraGridColumn column0 = band.Columns[0]; column0.CellMultiLine = Infragistics.Win.DefaultableBoolean.True; column0.EditorComponent = this.ultraFormattedTextEditor1; }
To get the links to show up, you use our custom XML format. It's very similar to HTML. The easiest way for you to figure out how to do this is for you to go to the Value property on the UltraFormattedTextEditor control and use the editor. The editor here allows you to edit text just like you would in a word processor and then you can switch tabs to see the XML that generates that text. So you can set up your text with line breaks and hyperlinks.
Here's a simple example of some XML which gets you the two links you want:
"<a href=\"Url 270742\">270742</a><br/><br/><a href=\"Url 270746\">270746</a><br/>"
So the cell in the grid would have to return this xml instead of the one you are building now with the Environment.NewLine characters in it.
Lastly, to respond to these links you hook the LinkClicked event on the UltraFormattedTextEditor control (the grid has no event for this, so that why you need the extra control).
The event args gives you the link text and the link reference as well as a Context, which in this case will be the UltraGridCell.