Display Unicode characters in ASP.Net RDLC Report using C# and VB.Net

Last Reply 26 days ago By pandeyism

Posted 26 days ago

How to insert Unicode Character in rdlc report field, when I tried I got the error (expression used in the field is Chr(&H1F536))

Error1The Value expression for the textrun ‘Textbox12.Paragraphs[0].TextRuns[0]’ contains an error: [BC30742] Value '128310' cannot be converted to 'Char'.

 

 

You are viewing reply posted by: pandeyism 26 days ago.
Posted 26 days ago

Hey satabeach,

Please refer below sample.

For creating RDLC report refer below article link.

How to create RDLC report step by step in ASP.Net using C# and VB.Net

HTML

<div>
    <asp:ScriptManager ID="Scriptmanager1" runat="server">
    </asp:ScriptManager>
    <rsweb:ReportViewer ID="ReportViewer1" runat="server">
    </rsweb:ReportViewer>
</div>

Namespaces

C#

using System.Data;
using Microsoft.Reporting.WebForms;

VB.Net

Imports System.Data
Imports Microsoft.Reporting.WebForms

Code

C#

protected void Page_Load(object sender, EventArgs e)
{
    if (!IsPostBack)
    {
        ReportViewer1.ProcessingMode = ProcessingMode.Local;
        ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/Report.rdlc");
        DataTable dt = GetData();
        ReportDataSource datasource = new ReportDataSource("Customers", dt);
        ReportViewer1.LocalReport.DataSources.Clear();
        ReportViewer1.LocalReport.DataSources.Add(datasource);
    }
}

private DataTable GetData()
{
    DataTable dt = new DataTable();
    dt.Columns.AddRange(new DataColumn[] { new DataColumn("CustomerID", typeof(int)), new DataColumn("Name", typeof(string)), new DataColumn("UniCodeChar", typeof(string)) });
    dt.Rows.Add(1, "Mudassar Ahmed Khan", System.Convert.ToChar(System.Convert.ToUInt32("2605", 16)));
    dt.Rows.Add(2, "John Hammond", System.Convert.ToChar(System.Convert.ToUInt32("2602", 16)));
    dt.Rows.Add(3, "Suzanne Mathews", System.Convert.ToChar(System.Convert.ToUInt32("260E", 16)));
    dt.Rows.Add(4, "Robert Schidner", System.Convert.ToChar(System.Convert.ToUInt32("2615", 16)));
    return dt;
}

VB.Net

Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
    If Not IsPostBack Then
        ReportViewer1.ProcessingMode = ProcessingMode.Local
        ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/Report.rdlc")
        Dim dt As DataTable = GetData()
        Dim datasource As ReportDataSource = New ReportDataSource("Customers", dt)
        ReportViewer1.LocalReport.DataSources.Clear()
        ReportViewer1.LocalReport.DataSources.Add(datasource)
    End If
End Sub

Private Function GetData() As DataTable
    Dim dt As DataTable = New DataTable()
    dt.Columns.AddRange(New DataColumn() {New DataColumn("CustomerID", GetType(Integer)), New DataColumn("Name", GetType(String)), New DataColumn("UniCodeChar", GetType(String))})
    dt.Rows.Add(1, "Mudassar Ahmed Khan", System.Convert.ToChar(System.Convert.ToUInt32("2605", 16)))
    dt.Rows.Add(2, "John Hammond", System.Convert.ToChar(System.Convert.ToUInt32("2602", 16)))
    dt.Rows.Add(3, "Suzanne Mathews", System.Convert.ToChar(System.Convert.ToUInt32("260E", 16)))
    dt.Rows.Add(4, "Robert Schidner", System.Convert.ToChar(System.Convert.ToUInt32("2615", 16)))
    Return dt
End Function

Screenshot