Hi Indradeo,
Please refer below Sample.
HTML
<asp:GridView runat="server" ID="gridView1">
</asp:GridView>
NameSpaces
C#
using System.Data;
using System.IO;
VB.Net
Imports System.Data
Imports System.IO
Code
C#
protected void Page_Load(object sender, EventArgs e)
{
DataTable dt = new DataTable();
dt.Columns.AddRange(new DataColumn[]
{
new DataColumn("Parameters"),
new DataColumn("CO2"),
new DataColumn("NO"),
new DataColumn("SO2"),
new DataColumn("CO"),
new DataColumn("PM"),
new DataColumn("Flow")
});
dt.Rows.Add("UoM", "%", "ppm", "ppm", "ppm", "mg/Nm", "m/s");
string stack1 = File.ReadAllText(Server.MapPath("~/Files/STACK1UNIT1.txt"));
string stack2 = File.ReadAllText(Server.MapPath("~/Files/STACK1UNIT2.txt"));
string[] splitParams = new[] { "CO2", "NO", "SO2", "CO", "PM", "FLOW" };
string[] values = stack1.Split(splitParams, StringSplitOptions.RemoveEmptyEntries);
dt.Rows.Add("UNIT#1", values[0], values[1], values[2], values[3], values[4], values[5]);
values = stack2.Split(splitParams, StringSplitOptions.RemoveEmptyEntries);
dt.Rows.Add("UNIT#2", values[0], values[1], values[2], values[3], values[4], values[5]);
gridView1.DataSource = dt;
gridView1.DataBind();
}
VB.Net
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
Dim dt As DataTable = New DataTable()
dt.Columns.AddRange(New DataColumn() {
New DataColumn("Parameters"),
New DataColumn("CO2"),
New DataColumn("NO"),
New DataColumn("SO2"),
New DataColumn("CO"),
New DataColumn("PM"),
New DataColumn("Flow")})
dt.Rows.Add("UoM", "%", "ppm", "ppm", "ppm", "mg/Nm", "m/s")
Dim stack1 As String = File.ReadAllText(Server.MapPath("~/Files/STACK1UNIT1.txt"))
Dim stack2 As String = File.ReadAllText(Server.MapPath("~/Files/STACK1UNIT2.txt"))
Dim splitParams As String() = {"CO2", "NO", "SO2", "CO", "PM", "FLOW"}
Dim values As String() = stack1.Split(splitParams, StringSplitOptions.RemoveEmptyEntries)
dt.Rows.Add("UNIT#1", values(0), values(1), values(2), values(3), values(4), values(5))
values = stack2.Split(splitParams, StringSplitOptions.RemoveEmptyEntries)
dt.Rows.Add("UNIT#2", values(0), values(1), values(2), values(3), values(4), values(5))
gridView1.DataSource = dt
gridView1.DataBind()
End Sub
Screenshot