Note that there are some explanatory texts on larger screens.

plurals
  1. POBuilding asp.net tables
    primarykey
    data
    text
    <p>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:</p> <pre><code>&lt;?php */ retrive the data from the database and store it in an array using $row_sql = mysql_fetch_array() function /* .... .... ?&gt; &lt;table&gt; &lt;tr&gt; &lt;td&gt;&lt;?php $row_sql['fieldname']; ?&gt;&lt;/td&gt; &lt;/tr&gt; .... .... &lt;/table&gt; ?&gt; </code></pre> <p>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.</p> <p>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?</p> <p>Update: Ok here is what I did but I am still getting an error.</p> <p>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:</p> <blockquote> <p>foreach statement cannot operate on variables of type 'System.Data.DataTable' because 'System.Data.DataTable' does not contain a public definition for 'GetEnumerator' </p> </blockquote>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload