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
close icon

ItemDataBound event equivalent

Hi,

I'm new to your controls, especially grid group control, i'm just wandering what is the equivalent ItemDataBound event on Grid Group Control and how to use it.


3 Replies

RS Rajarajeswari S Syncfusion Team January 18, 2008 06:29 AM UTC


Hi Emmanuel,

Thanks for Syncfusion products.

The event equvalent to ItemDataBound event is DataBound event which fires the control has been databound. Please refer the below code snippet which illustrates how to use the DataBound event of GGC:

protected void GridGroupingControl1_DataBound(object sender, EventArgs e)
{
float sum = 0;
foreach (Record r in this.GridGroupingControl1.Table.Records)
{
if (r.GetValue("price").ToString() != "0")
{
sum = sum + float.Parse(r.GetValue("price").ToString());
}
else
{
r.SetValue("price", sum);
}
}
}
Please refer the sample from the below link which ilustrates the above:

http://websamples.syncfusion.com/samples/Grid.Web/6.1.0.34/F71155/main.htm

In the above sample intially The Total is 0, it is calculated in the DataBound event which fires after the databing of grid.

Please refer the below link of our online documentation which contains all the details of GridGroupingControl:

http://www2.syncfusion.com/ug_61/gridweb/default.html

Our browser samples are available from the following link where you can get the live samples of GridGroupingControl:

http://www2.syncfusion.com/syncfusion/infrastructure/samplebrowserasp/samples.aspx?version=2_0

Please let me know if you have anyother concerns.

Regards,
Raji



EM Emmanuel January 19, 2008 09:16 AM UTC

Thanks for the help,

How about if i'm going to add new row with template columns and get the values of that template column and save it. I'm using just using ObjectDataSource. Also if possible can you give some alternatives like, how about if i'm going to do it on code behind.

Thanks.

>
Hi Emmanuel,

Thanks for Syncfusion products.

The event equvalent to ItemDataBound event is DataBound event which fires the control has been databound. Please refer the below code snippet which illustrates how to use the DataBound event of GGC:

protected void GridGroupingControl1_DataBound(object sender, EventArgs e)
{
float sum = 0;
foreach (Record r in this.GridGroupingControl1.Table.Records)
{
if (r.GetValue("price").ToString() != "0")
{
sum = sum + float.Parse(r.GetValue("price").ToString());
}
else
{
r.SetValue("price", sum);
}
}
}
Please refer the sample from the below link which ilustrates the above:

http://websamples.syncfusion.com/samples/Grid.Web/6.1.0.34/F71155/main.htm

In the above sample intially The Total is 0, it is calculated in the DataBound event which fires after the databing of grid.

Please refer the below link of our online documentation which contains all the details of GridGroupingControl:

http://www2.syncfusion.com/ug_61/gridweb/default.html

Our browser samples are available from the following link where you can get the live samples of GridGroupingControl:

http://www2.syncfusion.com/syncfusion/infrastructure/samplebrowserasp/samples.aspx?version=2_0

Please let me know if you have anyother concerns.

Regards,
Raji





RS Rajarajeswari S Syncfusion Team January 22, 2008 04:24 AM UTC


Hi Emmanuel,

Sorry for the delayed response.

Please refer the below code snippet which illustrates you to create EditItemTemplate which is inherited from ITemplate.

if (e.TableCellIdentity.Column.Name == "Column2")
{
Syncfusion.Web.UI.WebControls.Shared.DropDownCalendarControl dropdown = new DropDownCalendarControl();
dropdown.ClientObjectId = "ddcal";
dropdown.CustomFormat="MM/dd/yy";
dropdown.Format = DateTimeFormatType.CustomString;
//Here we adding the DropDownListBox programmatically
using ITemplate Interface
TemplateClass mytemp = new TemplateClass(dropdown);
e.TableCellIdentity.Column.EditItemTemplate = mytemp;
}


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);
}
}

Please refer the below KB link to get more detail on this and a sample which illustrates the above:

http://www.syncfusion.com/support/kb/grid/Default.aspx?ToDo=view&questId=373

Please refer the below KB link to get more details on creating Template columns in Design time:

http://www.syncfusion.com/support/kb/grid/Default.aspx?ToDo=view&questId=192


Please let me know if this helps you out.

Regards,
Raji



Loader.
Live Chat Icon For mobile
Up arrow icon