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 7059189
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:12:08+00:00 2026-05-28T04:12:08+00:00

I am a PHP developer but now I am learning asp.net with C# as

  • 0

I am a PHP developer but now I am learning asp.net with C# as it is a requirement of our company. I am familiar with the basics of C# and oops. The problem I am facing is that I learned how to retrieve values from the database and make a data table. Now from this I know that I can bind a grid control to display the data but this technique restricts me to do some of my own stuff to the datagrid. Now what I want is that I used to hard code the table in PHP if I needed to build a table
like:

<?php
*/
retrive the data from the database and store it in an array using $row_sql = mysql_fetch_array() function
/*
....
....
?>
<table>
<tr>
<td><?php $row_sql['fieldname']; ?></td>
</tr>
....
....

</table>
?>

I know that I can do such a thing with a repeater but not sure that I want to use such a control or its just because that i am not so familiar with asp.net style.

So can anyone please guide me how can I do this?
Or please tell me what should I do to learn asp.net if I know how to do it in PHP?

Update:
Ok here is what I did but I am still getting an error.

Firstly I created a database by filling the dataset from dataadapter, then I used the code as suggested but I am getting the following error:

foreach statement cannot operate on variables of type ‘System.Data.DataTable’ because ‘System.Data.DataTable’ does not contain a public definition for ‘GetEnumerator’

  • 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-28T04:12:09+00:00Added an answer on May 28, 2026 at 4:12 am

    You’re not limited to using only the Grid controls at your disposal – you can generate your own markup by looping through the data rows in the specific data table. You can for instance do something like this:

    <%
    foreach (DataRowView dr in myDataTable.AsDataView())
    {
        Response.Write("<tr>");
        Response.Write("<td>" + dr["Column1"].ToString() + "</td>");
        Response.Write("<td>" + dr["Column2"].ToString() + "</td>");
        Response.Write("<td>" + dr["Column3"].ToString() + "</td>");
        Response.Write("</tr>");
    }
    %>
    

    That will loop through each data row in the data table and write out the contents of columns 1-3 (assuming their names are “Column1”, “Column2” and “Column3”, of course), each in their own TD, wrapped in a TR. But I’m sure you figured that out already…

    My suggestion would be to rather implement an MVC framework (whether it be the ASP.NET MVC framework or your own), as it would be easier to adapt, coming from a PHP background.

    EDIT I updated the code snippet to use the DataView type for enumeration… Just remember to include the System.Data namespace to use the “AsDataView()” extension method. Alternatively, you could get a DataView as follows:

    <%
    foreach (DataRowView dr in new DataView(myDataTable))
    {
        // code...
    }
    %>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Now, I'm learning python but I'm PHP web developer. I don't interest about terminal
I'm a PHP developer and now I use Notepad++ for code editing, but lately
I'm been a PHP developer for quite some time now but until today I've
I am a PHP developer moving into an ASP.NET environment. I would like to
I'm a php developer but not experience in training now and got a task
I'm not a PHP developer but i've seen in a couple of places that
I'm mostly a Rails developer but sometimes, I have to code in PHP. Because
I've been a PHP developer for many years now, with many tools under my
I've been a Facebook developer for a while now, but I'm starting fresh with
I'm a former PHP developer now doing WPF/C# applications, and am having trouble understanding

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.