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.

GridColumnDescriptor : FooterTemplate unvisible

Thread ID:

Created:

Updated:

Platform:

Replies:

78157 Dec 2,2008 06:56 AM Dec 11,2008 06:34 AM ASP.NET Web Forms (Classic) 7
loading
Tags: GridGroupingControl
Lucie Houel
Asked On December 2, 2008 06:56 AM

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



Rajarajeswari S [Syncfusion]
Replied On December 3, 2008 03:14 AM

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






Lucie Houel
Replied On December 3, 2008 03:34 AM

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


Lucie Houel
Replied On December 3, 2008 09:32 AM

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


Rajarajeswari S [Syncfusion]
Replied On December 8, 2008 05:51 AM

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


Lucie Houel
Replied On December 9, 2008 06:28 AM

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




Lucie Houel
Replied On December 11, 2008 04:08 AM

Nobody can help :(


Rajarajeswari S [Syncfusion]
Replied On December 11, 2008 06:34 AM

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




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.

;