Hai all,
I need to insert a link label inside a grid. Is it possible to do that. The problem is the link data is going to be fed by a database and the link lable should come at the first column of the grid. Is there any way to do that. Please help with some code samples if possible. Thank you in advance for all your help.
You could set the Style property of the column to FormattedText, then set the column.Header.VisiblePosition to 0 to make sure that it's the first visible column. Your best bet would be to do this in the InitializeLayout event:
private void ultraGrid1_InitializeLayout(object sender, InitializeLayoutEventArgs e){ UltraGridColumn column = e.Layout.Bands[0].Columns[0]; column.Style = Infragistics.Win.UltraWinGrid.ColumnStyle.FormattedText; column.Header.VisiblePosition = 0;}
-Matt
I'm not able to get a link label appearence with this approach. Is there any changes i should make in the code. And also Could you help me how i could handle the event on some mouse click and others. Cause i'm new to infragistics controls. Thank u so much for your help.
Am able to capture the link click in the link clicked event but it comes with two problems
1. I'm not able to capture from which cell from which cell i got this event click.
2. If I'm having same values in more than one cell in the column i'm having the link on the click one of the link the other link also turns purple.
Is there any way to solve my problems. Please advice. Thank you very much.
1) The e.Context provides the UltraGridCell that was clicked in this case
2) The editor maintains a VisitedLinks collection, so if the user clicks on a single value, then any other cells that contain that value will also be clicked. The only way around this is to either create a new editor for each cell, or create a new editor only for the cells that will have duplicate values (all of which can be done in the InitializeRow event, then setting the EditorControl property of a cell).
Are you saying that i need to insert a new control on the row initialize event? I've thought of keeping the visited link colors as blue. Is this a right way? Infact in my application i don't need to show them as purple when a user clicks the link thats why i've thought way. Please tell me is it a right solution. Or can you tell me in detail how can i enable duplicate values in the grid.
If you don't care about showing a link as visited, then yes, the easiest solution is to keep the color of visited links as the same color as they are when they haven't been clicked. Doing this is far more efficeint than creating a new control for each row.
Okie. I'm not sure if thats gonna bring any problem. But thank you so much matt for all your help. Just tell me one thing will i be able to classify the data from each cell even though i have same value in them by the context value in the linkclicked event?
thanks mike for ur reply. I've handled it in the way you told. i jus want the text alone to be as link. So used the control.
BTW.. if you want text and a link in the cell, then the way you are doing it is correct. If you want the entire cell to be a link, then you could just set teh Style of the column to URL.
Anyway, I don't think LinkClicked gives you a mouse button. So you would have to trap the MouseDown event on the grid and simply record the last mouse button that was used in a variable.
Is it possible to get which mouse button is clicked in the linkclicked event?
Since you have the actual UltraGridCell through the Context, you'll be able to get the row, and thus the value of the other cells.