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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

how can i change the header columns caption for GridListControl

Thread ID:

Created:

Updated:

Platform:

Replies:

101738 Nov 17,2011 10:55 AM UTC Nov 30,2011 06:32 AM UTC WinForms 10
loading
Tags: GridControl
reda
Asked On November 17, 2011 10:55 AM UTC

how can i change the header columns caption for GridListControl
thank you for helping


Ragamathulla B [Syncfusion]
Replied On November 17, 2011 01:31 PM UTC

Hi Reda,

Thank you for your interest in Syncfusion products,

You can change the GridListControl caption text by using 'QueryCellInfo'. The following code explains the same.

void Grid_QueryCellInfo(object sender, Syncfusion.Windows.Forms.Grid.GridQueryCellInfoEventArgs e)
{
if (e.ColIndex == 1 && e.RowIndex == 0)
e.Style.Text = "TextChanged";
}

Please refer to the sample which illustrates the same.

http://www.syncfusion.com/downloads/Support/DirectTrac/77699/GLCCaptionChange-1389943268.zip

Please let me know if you have any further concerns.

Regards,
Ragamathullah B.


reda
Replied On November 17, 2011 03:21 PM UTC

sorry it doent work

Dim con As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source =" & Application.StartupPath & "\databind.mdb")
Dim cmd As New OleDbCommand()

Dim da As New OleDbDataAdapter()
Dim ds As New DataSet()

con.Open()
With cmd

.Connection = con
.CommandType = CommandType.TableDirect
.CommandText = "select*from Categories"

End With
da.SelectCommand = cmd
da.Fill(ds, "Categories")
Me.GridControl1.ColStyles(2).CellType = "GridListControl"
Me.GridControl1.ColStyles(2).DropDownStyle = Syncfusion.Windows.Forms.Grid.GridDropDownStyle.Exclusive
Me.GridControl1.ColStyles(2).DataSource = ds.Tables(0)
Me.GridControl1.ColStyles(2).DisplayMember = "CategoryName"
Me.GridControl1.ColStyles(2).ValueMember = "CategoryID"
Me.GridControl1.ColStyles(2).IsAutoComplete()

Me.GridControl1.CurrentCell.ShowDropDown()




i want to change the header columns caption "CategoryName" to cat name
and "CategoryID" to my id

i use the GridControl1 combo type GridListControl

thanks for help


reda
Replied On November 17, 2011 03:22 PM UTC

sorry it doent work

Dim con As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source =" & Application.StartupPath & "\databind.mdb")
Dim cmd As New OleDbCommand()

Dim da As New OleDbDataAdapter()
Dim ds As New DataSet()

con.Open()
With cmd

.Connection = con
.CommandType = CommandType.TableDirect
.CommandText = "select*from Categories"

End With
da.SelectCommand = cmd
da.Fill(ds, "Categories")
Me.GridControl1.ColStyles(2).CellType = "GridListControl"
Me.GridControl1.ColStyles(2).DropDownStyle = Syncfusion.Windows.Forms.Grid.GridDropDownStyle.Exclusive
Me.GridControl1.ColStyles(2).DataSource = ds.Tables(0)
Me.GridControl1.ColStyles(2).DisplayMember = "CategoryName"
Me.GridControl1.ColStyles(2).ValueMember = "CategoryID"
Me.GridControl1.ColStyles(2).IsAutoComplete()

Me.GridControl1.CurrentCell.ShowDropDown()




i want to change the header columns caption "CategoryName" to cat name
and "CategoryID" to my id

i use the GridControl1 combo type GridListControl

thanks for help


Ragamathulla B [Syncfusion]
Replied On November 18, 2011 03:40 AM UTC

Hi Reda,

We deeply for the delay,

You can get the DropDownGridListcellRender while the CurrentcellShowedDropDown event is triggered, and also you can invoke the querycellinfo event inside of this above event. You can change the caption text in the DropDownGridListControl by using ‘QueryCellInfo’ event. The following code explains the same.

void gridControl1_CurrentCellShowedDropDown(object sender, EventArgs e)
{
GridDropDownGridListControlCellRenderer render = this.gridControl1.CurrentCellRenderer as GridDropDownGridListControlCellRenderer;
render.ListControlPart.Grid.Model.QueryCellInfo += new GridQueryCellInfoEventHandler(Model_QueryCellInfo);
}

void Model_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e)
{
if (e.ColIndex == 1 && e.RowIndex == 0)
e.Style.Text = "Caption";
}

Please refer to the following sample which illustrates the same.

http://www.syncfusion.com/downloads/Support/DirectTrac/84883/ComboBoxGLC15919331189894479.zip

Please let me know if you have any further concerns.

Regards,
Ragamathullah B.


reda
Replied On November 18, 2011 12:02 PM UTC

im so sorry to bother you
and im sorry to say that doesnt work
============
Private Sub Model_QueryCellInfo(ByVal sender As Object, ByVal e As GridQueryCellInfoEventArgs)
If e.ColIndex = 2 Then 'AndAlso e.RowIndex =3 Then
e.Style.Text = "Caption"
End If
End Sub


Private Sub GridControl1_CurrentCellShowedDropDown1(sender As Object, e As System.EventArgs) Handles GridControl1.CurrentCellShowedDropDown
Dim render As GridDropDownGridListControlCellRenderer = TryCast(Me.GridControl1.CurrentCellRenderer, GridDropDownGridListControlCellRenderer)
AddHandler render.ListControlPart.Grid.Model.QueryCellInfo, AddressOf Model_QueryCellInfo
End Sub
=======================
it not change the header columns caption only it change the all columns text and one columns only


thank you so much


reda
Replied On November 18, 2011 05:57 PM UTC

there is my sample pl Modify cause
it not change the header columns caption only it change the all columns text and one columns only i want this

=============================
change the header columns caption only for columns

1- DisplayMember header columns caption only
2- ValueMember header columns caption only



gridcontrolsample_c7f7bbc1.rar

Ragamathulla B [Syncfusion]
Replied On November 21, 2011 03:23 PM UTC

Hi Reda,

Thanks for the update.

You can change only header caption by using 'CellType' property. The following code explains the same.

Private Sub Model_QueryCellInfo(ByVal sender As Object, ByVal e As GridQueryCellInfoEventArgs)
If e.ColIndex = 2 And e.Style.CellType = "Header" Then 'AndAlso e.RowIndex =3 Then
e.Style.Text = "Caption"
End If
End Sub

please refer to the following sample which illustrates the same.

http://www.syncfusion.com/downloads/Support/DirectTrac/84883/gridcontrolsample555388043.zip

please let me know if you have any further concerns.

Regards,
Ragamathullah B.


reda
Replied On November 21, 2011 05:16 PM UTC

thank you so much it works great with DisplayMember column
and it doesnot work with ValueMember column
im so sorry i know i bothered you forgive me and thank you for help


reda
Replied On November 21, 2011 11:06 PM UTC

thank you now sooooooooooo much now it worked but sorry
still one thing
i tryed to do select from GridListControl text and it doesnot

==================
look at this
======================
Dim con As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source =" & Application.StartupPath & "\databind.mdb")
Dim cmd As New OleDbCommand()

Dim da As New OleDbDataAdapter()
Dim ds As New DataSet()

con.Open()
With cmd

.Connection = con
.CommandType = CommandType.TableDirect
.CommandText = "select*from Categories"

End With
da.SelectCommand = cmd
da.Fill(ds, "Categories")
Me.GridControl1.ColStyles(2).CellType = "GridListControl"
Me.GridControl1.ColStyles(2).DropDownStyle = Syncfusion.Windows.Forms.Grid.GridDropDownStyle.Exclusive
Me.GridControl1.ColStyles(2).DataSource = ds.Tables(0)
Me.GridControl1.ColStyles(2).DisplayMember = "CategoryName"
Me.GridControl1.ColStyles(2).ValueMember = "CategoryID"
Me.GridControl1.ColStyles(2).IsAutoComplete()
Me.GridControl1.CurrentCell.ShowDropDown()

============================================
-------------------------------------- here the error --------
dim GridListControl_text as string
GridListControl_text= Me.GridControl1(Me.GridControl1.CurrentCell.RowIndex, 2).CellValue

select*from tbl_name2 where feild1='" & GridListControl_text & "'

-----------------------------
Me.GridControl1(Me.GridControl1.CurrentCell.RowIndex, 3).Text = "the resualt from query"




Ragamathulla B [Syncfusion]
Replied On November 30, 2011 06:32 AM UTC

Hi Reda,

We deeply regret for the delay,

You can get the text value by using CellValue property. The following code explains the same.

Me.GridControl1(Me.GridControl1.CurrentCell.RowIndex, 3).CellValue= "FilterQuery"

Please let me know if you have any further concerns.

Regards,
Ragamathullah B.


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.

Warning Icon 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.Close Icon

;