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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Can GripGroupingControl recognize html syntax

Thread ID:

Created:

Updated:

Platform:

Replies:

117875 Jan 2,2015 10:33 AM UTC Jan 12,2015 07:06 AM UTC ASP.NET Web Forms (Classic) 3
loading
Tags: GridGroupingControl
Chong Yee Mei
Asked On January 2, 2015 10:33 AM UTC


Hi,

Is there anyway to make the grid grouping control to recognize data with html tag?


Thanks & best regards
Chong 

Shanmugaraja K [Syncfusion]
Replied On January 5, 2015 08:31 AM UTC

Hi Chong,

 

Thanks for using Syncfusion products.

 

We would like to let you know that your requirement has been achieved by using the string values within the HTML Tag. Please refer the below code snippets.

 

[CS]

 

        protected void Page_Load(object sender, EventArgs e)

        {

            if (!IsPostBack)

                GetData();

        }

        public void GetData()

        { 

         List<MyClass> list= new List<MyClass>();

            list.Add(new MyClass(1,Convert.ToDateTime("10/11/2010"),"<i><font color=\"Red\"> Html Tag </font></i>","<b>aaaa</b>",2322));

            list.Add(new MyClass(2, Convert.ToDateTime("11/12/2011"), "<i><font color=\"Red\"> Html Tag </font></i>""<b>bbbb</b>", 2323));

            list.Add(new MyClass(3, Convert.ToDateTime("12/10/2012"), "<i><font color=\"Red\"> Html Tag </font></i>""<b>cccc</b>", 2324));

            list.Add(new MyClass(4, Convert.ToDateTime("07/08/2013"), "<i><font color=\"Red\"> Html Tag </font></i>""<b>dddd</b>", 2325));

            list.Add(new MyClass(5, Convert.ToDateTime("05/07/2014"), "<i><font color=\"Red\"> Html Tag </font></i>""<b>eeee</b>", 2326));

            this.ggc.DataSource=list;

            this.ggc.DataBind();

        }

 

For your convenience we have attached simple sample with the above code snippet please refer the below link. We suspect that this is your requirement, if not, could you please give more information about your exact requirement. So, that we could provide a better solution quickly.

 

Regards,

Shanmugaraja K

Attachment: WebApplication1_e9c68e1f.zip

Chong Yee Mei
Replied On January 12, 2015 03:02 AM UTC

Hi Shanmugaraja,

I have tried the code provided by you and it works for displaying the data on the grid. 

However, once I exported the data to excel using GridExcelExport class, it does not retain the html styling and also the formatting i have set to certain date/number columns after I exported to excel.

Kindly advice whether it can be done Thanks.

Shanmugaraja K [Syncfusion]
Replied On January 12, 2015 07:06 AM UTC

Hi Chong,

Thanks for your update.

Query 1: Excel Export with Html styling.

We have analysed your requirement. Currently we don’t have support for the feature “Exporting HTML style to Excel Cell”. This is confirmed as a feature request and it will be available in our future volume releases. The feature implementation would also greatly depend on the factors such as product design, code compatibility and complexity.  We do not provide confidential information in general forum. Please create new incident in Direct-Trac for better follow up.

Query 2: Excel Export with Date/Number formatting.

We would like to let you know that your requirement has been achievd by handling “ExportExcelCellHandler” event. Please refer the below code snippets.

[CS]

protected void Page_Load(object sender, EventArgs e)

       {

           if (!IsPostBack)

               GetData();

           this.ggc.TableDescriptor.Columns[1].Appearance.AnyCell.Format = "yyyy/MM/dd";

           this.ggc.TableDescriptor.Columns[2].Appearance.AnyCell.Format = "$####.##";

       }

 …..

protected void Button1_Click(object sender, EventArgs e)
        {
            GridExcelExport excelExport = new GridExcelExport(this.ggc, "ExcelExport.xls");
            excelExport.ExportNestedTable = true;
            excelExport.FormatExcelCellHandler += new ExportExcelCellHandler(excelExport_FormatExcelCellHandler);
            excelExport.Export();
        }
 
        void excelExport_FormatExcelCellHandler(object sender, ExcelExportEventArgs e)
        {
            if (e.RowElement.IsRecord() && e.ExcelCell.Column == 2) // condition to check the record and column as 2th column(Date column)
            {
                e.ExcelCell.Cells[0].NumberFormat = "yyyy/MM/dd";
            }
            if (e.RowElement.IsRecord() && e.ExcelCell.Column == 3) // condition to check the record and column as 3rd column(Number column)
            {
                e.ExcelCell.Cells[0].NumberFormat = "$####.##";
            }
        }

For your convenience we have created simple sample and the same can be downloaded from the following link.

Sample link: http://www.syncfusion.com/downloads/support/directtrac/117875/Format_Export416113412.zip

Please let us know if you need further assistance.

Regards,

Shanmugaraja K



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.

Warning Icon 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.Close Icon

;