We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Hide rows and insert row

Thread ID:

Created:

Updated:

Platform:

Replies:

75390 Jul 23,2008 11:03 PM Jul 31,2008 05:06 AM Windows Forms 6
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On July 23, 2008 11:03 PM

Hello:

I have a problem to use gridcontrol when I hide rows and then insert row .

example:
gridcontrol have 5 rows , rows 2 and 3 are hide , when I select row 1 and using InsertRange(1,1),and then hide row will hideing wrong place.

How can I using InsertRange and let the hide row in the right place at the same time?

think for any help.

Best Regards

Quenton



Sri Rajan [Syncfusion]
Replied On July 25, 2008 07:02 AM

Hi Quenton,

Thank you for your interest in Syncfusion products.

You need to hide the rows(2 & 3) before insert. Then only it will hide the rows in the correct places.
Please refer the below code for more details.

this.gridControl1.HideRows[2] = true;
this.gridControl1.HideRows[3] = true;
this.gridControl1.Model.Rows.InsertRange(1, 1);


Please let me know if this helps.

Best Regards,
Srirajan.


Administrator [Syncfusion]
Replied On July 29, 2008 09:19 AM

Hi Srirajan:

Thanks for your response.

My previous example is not clear , I post the simple sample .

' I using gridcontrol and hide row 3 and 4
Public Sub New()
InitializeComponent()
Me.GridControl1.HideRows(3) = True
Me.GridControl1.HideRows(4) = True
End Sub

' Then I using button to insert row
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim Row, Col As Integer
Me.GridControl1.CurrentCell.GetCurrentCell (Row, Col )
Me.GridControl1.Model.Rows.InsertRange(Row, Col )

End Sub

Execute program,Imput any text in row(2),and select row(1) push button to insert row,and previous imput text is disappear .

Because my program must to allow select anywhere to insert.so i get this problem.


Best Regards

Quenton



Administrator [Syncfusion]
Replied On July 29, 2008 09:32 AM

Hi Srirajan:

BY the way , I have another question.
I store data to tag of cell , and using Me.Model.CutPaste.Copy() to copy this cell , but tag was not copied .

How can I copy tag in cell ?


Best Regards

Quenton


Sri Rajan [Syncfusion]
Replied On July 30, 2008 07:38 AM

Hi Quenton,

Thank you for your continued interest in Syncfusion products.

Please try this code to hide rows instead of using HideRows property to solve this issue.

Me.gridControl1.RowHeights(2) = 0 Me.gridControl1.RowHeights(3) = 0


Here is the code to copy forumula.

'Set this in Form_Load event.
Dim model As GridFormulaCellModel = TryCast(Me.gridControl1.CellModels("FormulaCell"), GridFormulaCellModel)
model.Engine.FormulaCopyFlags = model.Engine.FormulaCopyFlags Or GridFormulaCopyFlags.ClipBoardFormula


Please let me know if this helps.

Best Regards,
Srirajan.




Administrator [Syncfusion]
Replied On July 30, 2008 10:37 PM

Hi Srirajan:

Thanks for your response.

The hide row problem is solved.

And I post the example to describe tag problem.

' I declare this class to store my information
Public Class Test
Public no As Integer
Public name As String

Public Sub New(ByVal n As Integer, ByVal name As String)
no = n
name = name
End Sub
End Class


and store this object in tag of cell.

Dim t As New Test(0, "0")
GridControl1(1, 2).Tag = t

then I using CutPaste to copy.
GridControl1.Selections.Ranges.GetRowRanges(GridRangeInfoType.Rows) GridControl1.CutPaste.Model.CutPaste.Copy()

and paste.

GridControl1.CutPaste.Paste()

but tag didn't copy.

How can I copy tag in this situation ?

Best Regards

Quenton


Sri Rajan [Syncfusion]
Replied On July 31, 2008 05:06 AM

Hi Quenton,

Thank you for your interest in Syncfusion products.

If you want to copy/paste cells with tags, then the object that you are using as a Tag must be Serializable (so the Framework can save it to the Clipboard).

One other comment on Tags is that if your object that you are using as a Tag implements ICloneable, then setting an object into the Tag will set a clone into the Tag, and not the actual object.

Here is the minimal sample which implements this task.
http://websamples.syncfusion.com/samples/grid.windows/F75390/main.htm

Please let me know if this helps.

Best Regards,
Srirajan.


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;