Example of basic data output using C# in ASP.NET?

  • Thread starter Thread starter planetthoughtful
  • Start date Start date
P

planetthoughtful

Hi All,

I'm curious to know if anyone can point me to some basic but complete
examples of C# ASP.NET code that retrieves and displays records from an
SQL Server table?

I've been experimenting with Visual Web Developer 2005 Express, and I
have managed to create a page that displays a GridView, however I'm
more interested at this point in learning from examples where datasets
are explicitly created and output to the browser by iterating through
the recordset and writing HTML etc.

Can anyone point me to any examples like this?

Many thanks in advance!

Much warmth,

planetthoughtful
 
If you want more control of the output, then look at the asp:repeater
control.

If you're trying to revert back to the asp days of

Response.Write "<table>
Response.Write "<tr>"

You're barking up the wrong tree,

(outside the possibilty youre wrting your own server controls. (not
usercontrols, but server controls).

...

98% of the time, I think you want to stick with the DataBind()'ing .. and
the controls MS provides.

The repeater takes more setup time, but gives you the most control.
 
sloan said:
If you want more control of the output, then look at the asp:repeater
control.

If you're trying to revert back to the asp days of

Response.Write "<table>
Response.Write "<tr>"

You're barking up the wrong tree,

(outside the possibilty youre wrting your own server controls. (not
usercontrols, but server controls).

In a sense, yes, that is what I'm trying to do - or, to put it another
way, I'm coming across from PHP, and I want to get productive in C# as
quickly as possible. If it's not the best code, I can live with that.

But thanks for your thoughts - it at least gives me an idea of where I
should be aiming at.

Much warmth,

planetthoughtful
 
Back
Top