Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6954215
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:34:37+00:00 2026-05-27T14:34:37+00:00

I want to display data in my own format from Mysql database connecting through

  • 0

I want to display data in my own format from Mysql database connecting through ASP.NET.
Currently I’m using MySQLDataGrid to display values in table format.

My code is

myConnection = New MySqlConnection("server=localhost; user id=root; password='';       database=test; pooling=false;")
strSQL = "SELECT * FROM tablename;"
myDataAdapter = New MySqlDataAdapter(strSQL, myConnection)
myDataSet = New Dataset()
myDataAdapter.Fill(myDataSet, "mytable")
MySQLDataGrid.DataSource = myDataSet
MySQLDataGrid.DataBind()
and asp code is:
<asp:DataGrid id="MySQLDataGrid" runat="server" />

its displaying all columns in Grid format.
But i actually wanted to display in HTML table format with some included/exclude fields. like below.

UserName :
City :
Address:
etc…

Can I have a simple example code on how to do it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T14:34:38+00:00Added an answer on May 27, 2026 at 2:34 pm

    By default, columns are auto-generated corresponding to the binded datasource. You can disable this with the property AutoGenerateColumns by setting it to False:

    <asp:DataGrid ... AutoGenerateColumns="False">
    

    Then you can define yourself the columns you’d like to show under the <columns/> tag

    <asp:DataGrid ... >    
        <Columns>
            <asp:BoundColumn 
                HeaderText="Username" 
                DataField="UserName"/>
    
            <asp:BoundColumn 
                HeaderText="City" 
                DataField="City"/>
    
            ...
    
        </Columns>
    </asp:DataGrid>
    

    There a few types of columns:

    BoundColumn Displays a column bound to a field in a data source. It displays each item in the field as text. This is the default column type of the DataGrid control.

    ButtonColumn Displays a command button for each item in the column. This allows you to create a column of custom button controls, such as Add or Remove buttons.

    EditCommandColumn Displays a column that contains editing commands for each item in the column.

    HyperLinkColumn Displays the contents of each item in the column as a hyperlink. The contents of the column can be bound to a field in a data source or static text.

    TemplateColumn Displays each item in the column following a specified template. This allows you to provide custom controls in the column.

    The documentation page for the DataGrid show a bunch of example on how to use the different types of columns (button columns, add a checkbox…)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to display data feed from an external database in a sidebar in
I want to display data in a tabular form using <ul> and <li> as
I have multiple SharePoint lists and want to display data from them on to
On one of our Java application screens, we want to display data loaded from
I want to display tabular type data, but it will not be coming from
Currently I'm getting data in jsp using scriptlet but now want to use JSTL
I want to display data in two columns as below Entry 1 Entry 2
I have a huge set of data and want to display the data with
My data is such that I want to display values for the Employee and
I want to create application which would display spatial data on Map. I'm thinking

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.