RB
Ragamathulla B
Syncfusion Team
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.
RE
reda
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
RE
reda
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
RB
Ragamathulla B
Syncfusion Team
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.
RE
reda
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
RE
reda
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
RB
Ragamathulla B
Syncfusion Team
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.
RE
reda
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
RE
reda
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"
RB
Ragamathulla B
Syncfusion Team
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.