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

GridGroupingWebControl and dynamic inline edit template

Hi,

I am trying to edit a row in GridGroupingWebControl with TableEditMode.UseInlineTemplateForm. However, instead of creating the actual template in the aspx file, I would like to generate it dynamically. Is there any way I can do that ?

Thank you


10 Replies

JA Janagan Syncfusion Team April 28, 2008 04:02 PM UTC

HiSorin,

Thanks for your interest in Syncfusion products.

You can add item templates dynamically But the issue of dynamic creation of inline templates is suspected to be a feature. We will update you regarding this issue in two business days. Please refer the code mentioned below for item templates:



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 sample in the link below which illustrates the above:

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


Please try running the sample and let me know if this helps.

Regards,
Janagan.







SO Sorin April 28, 2008 04:56 PM UTC

Hi Janagan,


I already knew how to create item templates. My question refers to the creation of inline EDIT templates. Currently, the template is described as a table inside the aspx code. What I need is to be able to create an ITemplate object that the Syncfusion Group Grid would use when a row is in edit mode.

I noticed that the GridGroupiong control already has a public method
"public virtual ITemplate InlineFormModeTemplate", however it is not documented and it doesn't seem to work.


Sorin



MW Melba Winshia Syncfusion Team May 1, 2008 11:14 AM UTC

Hi Sorin,

We regret for the inconvenience caused.

You can add inline edit templates dynamically by using the below code snippet:



protected void GridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
//Look for the RecordField and AlternateField Cell.
if (e.TableCellIdentity.TableCellType == GridTableCellType.RecordFieldCell || e.TableCellIdentity.TableCellType == GridTableCellType.AlternateRecordFieldCell)
{
//Look for the Column Name "Column2" in the GridGroupingControl when it get rendered
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;
dropdown.Attributes.Add("onclick", "fun1(this);");
//Response.Write(dropdown.MinValue.Year.ToString());
dropdown.AutoPostBack = true;
System.Web.UI.WebControls.TextBox tb = new TextBox();
tb.ID = "TextBox2";
tb.Text = "TextBox";
//Here we adding the DropDownListBox programatically using ITemplate Interface
TemplateClass mytemp = new TemplateClass(dropdown,tb);
this.GridGroupingControl1.TableDescriptor.InlineFormModeTemplate = mytemp;


}

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

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



Please refer the sample in the below link which illustrates the above:

http://websamples.syncfusion.com/samples/Grid.Web/6.2.0.40/Grid_ASP_InlineFormMode_73249/main.htm

Please try this and let me know if this helps.

Thanks,
Melba



SO Sorin May 3, 2008 04:30 AM UTC

Melba,

Thank you for your help. The sample code is very usefull.

Best Regards,

Sorin





AD Administrator Syncfusion Team May 9, 2008 04:20 PM UTC

Regarding edit templates, I think I found a problem. I was trying to use the Syncfusion RichTextEditor control in an edit template for the Grid grouping control and the grid does not enter in edit mode anymore. The issue seems to happen only with RichEditControl, any other control I tried works fine.



JA Janagan Syncfusion Team May 15, 2008 08:31 AM UTC

Hi Sorin,

Thanks for posting your query to us.

I am afraid that I am not able to reproduce the issue of the richtextEditor in Edittemplate. The Grid enters the editmode and the richtexteditor appears in Edit mode. Also, I have created a sample to test this issue and please refer the sample in the link below:

http://websamples.syncfusion.com/samples/Grid.Web/6.2.0.40/Grid_ASP_RichTextEditor/main.htm


Please try running the sample and if still the issue exists could you please try reproducing it in the above sample so that we could analyse further and sort out the cause to provide you a better solution?

Thanks,
Janagan.





AD Administrator Syncfusion Team May 16, 2008 07:41 PM UTC

Thank you ! i will use your sample to corect my code.

Thank you again

Sorin



JA Janagan Syncfusion Team May 20, 2008 04:06 AM UTC

Hi Sorin,

Thanks for the update. Please let me know if you have any other questions.

Regards,
Janagan.



AD Administrator Syncfusion Team May 28, 2008 11:29 PM UTC

Hello,

It looks that, if you specify the Rich text Editor in the edit template in ASPX file, it works. I tried to create an inline edit template in C#, using ITemplate and adding a Rich Text Editor control and the grid doesn't enter in edit mode anymore. Could this be a bug ?





RS Rajarajeswari S Syncfusion Team July 1, 2008 08:46 AM UTC

Hi Sorin,

I am afraid that I am not able to reproduce the issue you have mentioned here. Please refer the sample from the below link, in which
RTE is used as InlineFormModeTemplarte, and also the grid enters into the Edit mode.

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

Please refer the video clip from the below link which illustrates the process clearly:

http://www.syncfusion.com/support/user/uploads/rte_fd8692d9.avi

Please let me know if you have any other concerns.

Regards,
Raji



Loader.
Live Chat Icon For mobile
Up arrow icon