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. Image for the cookie policy date

GridColumnDescriptor : FooterTemplate unvisible

Hi,

I'm using Essential Studio 6.3.0.30 with VS2008.

I'd like to add a button in the footer cell of the last column of the grid. So I do that :





I can't see the footer. Guess I have to write somewhere that the footer has to be shown, but I don't know where.

Thanks for your help.

LyLy



7 Replies

RS Rajarajeswari S Syncfusion Team December 3, 2008 08:14 AM UTC

Hi LyLy,

Thanks for using Syncfusion products.

On further analysis we have found that, in GGC there is no implementations for FooterTemplates. We will have it implemented for our neaxt future release.

We can have images on particullar cell, by setting the cell type as "Image". Plesae refer the below code snippet which illustrates this:

void GridGroupingControl1_QueryCellStyleInfo(object sender, Syncfusion.Web.UI.WebControls.Grid.Grouping.GridTableCellStyleInfoEventArgs e)
{
if (e.TableCellIdentity.TableCellType == Syncfusion.Web.UI.WebControls.Grid.Grouping.GridTableCellType.AlternateRecordFieldCell || e.TableCellIdentity.TableCellType == Syncfusion.Web.UI.WebControls.Grid.Grouping.GridTableCellType.RecordFieldCell)
{
if (e.TableCellIdentity.Column.Name == "City")
{
if (e.TableCellIdentity.RowIndex == 9)
{
e.Style.CellType = "Image";
e.Style.ImageUrl = "add.png";
}
}
}
}

Please refer the sample from the below link, which illustrates this:


http://www.syncfusion.com/support/user/uploads/Sample_3c712d74.zip

Please have a look at this and let me know if this helps you out.

Regards,
Raji







LH Lucie Houel December 3, 2008 08:34 AM UTC

Hi Raji

My problem is not to have an image, but to have a Image Button for just one of the colum :

For example :

CELL1 CELL2 CELL3 CHECKBOX
CELL4 CELL5 CELL6 CHECKBOX
CELL7 CELL8 CELL9 CHECKBOX
IMAGE BUTTON (footer)

I guess that if there is not footer, I have to put empty cell in my last row :

CELL1 CELL2 CELL3 CHECKBOX
CELL4 CELL5 CELL6 CHECKBOX
CELL7 CELL8 CELL9 CHECKBOX
EMPTY C EMPTY C EMPTY C IMAGE BUTTON

Have you other idea to do that ?

Thanks again for your help.

LyLy



LH Lucie Houel December 3, 2008 02:32 PM UTC

Hi again,

I can add a last row to my datasource (datatable), but I can't add an imagebutton to the last cell of this last row.

Could you please give me an example to do that ?

Thanks again.

LyLy



RS Rajarajeswari S Syncfusion Team December 8, 2008 10:51 AM UTC

Hi LyLy,

Thanks for the update.

Using ItemTemplates we can have other controls dynamically inside Grid. Please refer the below code snippet which illustrtaes this:

public class TemplateClass : ITemplate
{
private Control m_ctrlChildControl = null;
public TemplateClass(Control ctrlChildControl)
{
m_ctrlChildControl = ctrlChildControl;
}

public void InstantiateIn(Control container)
{
container.Controls.Add(m_ctrlChildControl);
}
}

void GridGroupingControl1_QueryCellStyleInfo(object sender, Syncfusion.Web.UI.WebControls.Grid.Grouping.GridTableCellStyleInfoEventArgs e)
{
if (e.TableCellIdentity.TableCellType == Syncfusion.Web.UI.WebControls.Grid.Grouping.GridTableCellType.AlternateRecordFieldCell || e.TableCellIdentity.TableCellType == Syncfusion.Web.UI.WebControls.Grid.Grouping.GridTableCellType.RecordFieldCell)
{
if (e.TableCellIdentity.Column.Name == "City")
{
if (e.Style.CellValue == "")
{
System.Web.UI.WebControls.ImageButton img = new System.Web.UI.WebControls.ImageButton();
img.ID = "Image1";
img.ImageUrl = "add.png";
TemplateClass mytemp = new TemplateClass(img);
e.TableCellIdentity.Column.ItemTemplate = mytemp;
}

}
}
}


As per your sample you are inserting an Empty row, and adding ImageButton on the last column, the above code checks for the last column empty cell to have a template.



Pleae refer the sample from the below link, which illustrates this:

http://www.syncfusion.com/support/user/uploads/Sample_13116dcc.zip


Please have a look at the above, and let us know if this helps you out.

Regards,
Raji



LH Lucie Houel December 9, 2008 11:28 AM UTC

Hi Raji,

Thanks a lot for your help.

I can have my last column with checkboxes and imagebutton, doing like that :

----------------------------------------------
My template class :
----------------------------------------------

Public Class ColonneTemplate
Implements ITemplate

Private ControlEnfant As Control = Nothing

Public Property CEnfant() As Control
Get
Return ControlEnfant
End Get
Set(ByVal Value As Control)
ControlEnfant = Value
End Set
End Property

Public Sub New(ByVal controlEnfant As Control)
Me.ControlEnfant = controlEnfant
End Sub


Public Sub InstantiateIn(ByVal container As System.Web.UI.Control) Implements System.Web.UI.ITemplate.InstantiateIn
container.Controls.Add(ControlEnfant)
End Sub

End Class

----------------------------------------------
In my vb file :
----------------------------------------------


Public Sub Load_GGC()

[...]

If GGC_Design.TableDescriptor.Columns.FindByMappingName("Sélection") Is Nothing Then
GGC_Design.TableDescriptor.UnboundFields.Add("Sélection")
GGC_Design.TableDescriptor.Columns.Add("Sélection")
End If

Dim c As New Control()
Dim temp_colonne As New ColonneTemplate(c)

GGC_Design.TableDescriptor.Columns.FindByMappingName("Sélection").ItemTemplate = temp_colonne

[...]

End Sub



Protected Sub GGC_Design_QueryCellStyleInfo(ByVal sender As Object, ByVal e As GridTableCellStyleInfoEventArgs) Handles GGC_Design.QueryCellStyleInfo

If e.TableCellIdentity.TableCellType = GridTableCellType.RecordFieldCell Or _
e.TableCellIdentity.TableCellType = GridTableCellType.AlternateRecordFieldCell Or _
e.TableCellIdentity.TableCellType = GridTableCellType.RecordPlusMinusCell Then

Dim r As Record
Dim id As String

r = e.TableCellIdentity.DisplayElement.ParentRecord
id = r.GetValue("id_lignedesign").ToString

If e.TableCellIdentity.TableCellType = GridTableCellType.RecordPlusMinusCell Then

If id.Length = 0 Then
e.Style.CellType = "Static"
End If

End If

If e.TableCellIdentity.TableCellType = GridTableCellType.RecordFieldCell Or e.TableCellIdentity.TableCellType = GridTableCellType.AlternateRecordFieldCell Then

If e.TableCellIdentity.Column.MappingName = "Sélection" Then

Dim ctemplate As ColonneTemplate

If id.Length <> 0 Then
Dim CB_Temp As New CheckBox
CB_Temp.ID = "CB_Valider_Global_Design"
CB_Temp.AutoPostBack = True
AddHandler CB_Temp.CheckedChanged, AddressOf CB_Valider_Global_Design_CheckedChanged
ctemplate = New ColonneTemplate(CB_Temp)
GGC_Design.TableDescriptor.Columns.FindByMappingName("Sélection").ItemTemplate = ctemplate
Else
Dim IB_temp As New ImageButton
IB_temp.ImageUrl = "../img/valider.gif"
IB_temp.ID = "IB_Valider_Global_Design"
AddHandler IB_temp.Click, AddressOf IB_Valider_Global_Design_Click
ctemplate = New ColonneTemplate(IB_temp)
GGC_Design.TableDescriptor.Columns.FindByMappingName("Sélection").ItemTemplate = ctemplate

End If

End If

End If

End If
End Sub


----------------------------------------------




It works, but there is still a problem : the button event is handled correctly, but I've got a problem with the checkbox event. When I click on a checkbox for the first time, the eventhandler is called one time, it's ok, but if I click on a second checkbox, the eventhandler is called two times (one for the first checkbox clicked and two for the second) and so one. After several click the eventhandler isn't called anymore. Guess all the checked changes are kept, but I need that just the last checked changed is handled.

Hope I'm clear :)

Thanks again for your help !

LyLy





LH Lucie Houel December 11, 2008 09:08 AM UTC

Nobody can help :(



RS Rajarajeswari S Syncfusion Team December 11, 2008 11:34 AM UTC

Hi LyLy,

This issue occurs only with CheckBox, but we can have a work around by binding the checkbox on its init event.


http://www.syncfusion.com/support/user/uploads/Sample_fee03381.zip


Please try like this and let me know if this helps you out.

Note:

Could you please create DirectTrac incident using your DirectTrac account for future support?

Regards,
Raji




Loader.
Live Chat Icon For mobile
Up arrow icon