I have created a table in my servers.aspx.cs page using asp.net c#code. this table is created successfully but just appearing at the top left of the page and not at the center. Please help to let it appear below masterpage contens.

Page code:

using System;
using System.Collections.Generic;
using System.Data;
using System.Data.OracleClient;
using System.Drawing;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.DataVisualization.Charting;
using System.Web.UI.WebControls;
using System.IO;
using System.Globalization;
using System.Threading;

namespace New
{
    public partial class Servers : System.Web.UI.Page
    {
        string oradb = "Data Source=(DESCRIPTION =" + "(ADDRESS = (PROTOCOL = TCP)(HOST = hqidlbmcdb50.hqh.intra.aexp.com)(PORT = 1521))" + "(CONNECT_DATA =" + "(SERVER = DEDICATED)" + "(SERVICE_NAME = TSOBMC0P)));" + "User Id=MyId;Password=Mypass;";
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                OracleConnection con = new OracleConnection(oradb);
                OracleCommand cmd = new OracleCommand();
                cmd.CommandText = "select DISTINCT hostname from PE.NODE where HOSTNAME like '%bas%' ORDER BY hostname ASC";
                cmd.Connection = con;
                con.Open();
                OracleDataReader dr = cmd.ExecuteReader();
                if (dr.HasRows)
                {
                    Response.Write("<div >");
                    Response.Write("<table border='1'>");
                    Response.Write("<tr><th>HOST NAME</th></tr>");
                    while (dr.Read())
                    {

                        Response.Write("<tr>");
                        Response.Write("<td>" + dr["HOSTNAME"].ToString() + "</td>");
                        Response.Write("</tr>");
                    }
                    Response.Write("</table>");
                    Response.Write("</div>");
                }
                else
                {
                    Response.Write("No Data In DataBase");
                }
                con.Close();
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }
        }
    }
}

please help

Related posts

Recent Viewed