I'm confused with choosing between several ways of getting result in ASP.NET.
For example, Web form control SqlDataSource
, you retrieve data from database and show results in other controls such as DataGridView
, BulletedList
etc. However all those things can be written in C#, creating a string which will hold your HTML codes with the retrived data, then you insert your Html code into div
using innerHTML
. What's the difference?
Example:
[ <div id='block1' runnat='server'></div]
and in CodeBehind
[ block1.innerHTML = myString;]
After writing C# code SqlConnect, Loops, Datatable, you put value of your HTML string into myString.
Why not to implement everything with C#?