R
Richard Coltrane
Hello
Im reading this article about the Gridview:
http://msdn.microsoft.com/msdnmag/issues/04/08/GridView/
Whilst I realise that im not forced to use their methods I do find it
confusing that the article states that the code below is an example of the
"recommended data binding approach in ASP 2.0".
Why is placing DAL level code and connection strings on every page that uses
data from a data store now the "recommended approach"?
The idea seems completely stupid on every level.
Richard
<%@ Page theme="SmokeAndGlass" %>
<html>
<head runat="server" />
<body>
<form runat="server">
<asp:TextBox runat="server" ID="EmpID" Text="3" />
<asp:button runat="server" Text="Refresh" />
<asp:SqlDataSource runat="server" ID="MySource"
ConnectionString="SERVER=(local);DATABASE=northwind;Integrated
Security=SSPI;"
DataSourceMode="DataSet"
SelectCommand="SELECT firstname, lastname FROM employees WHERE
employeeid > @MinID">
<SelectParameters>
<asp:ControlParameter Name="MinID" ControlId="EmpID"
PropertyName="Text" />
</SelectParameters>
</asp:SqlDataSource>
<asp:GridView runat="server" ID="grid"
DataSourceId="MySource"
AutoGenerateColumns="true">
</asp:GridView>
</form>
</body>
</html>
Im reading this article about the Gridview:
http://msdn.microsoft.com/msdnmag/issues/04/08/GridView/
Whilst I realise that im not forced to use their methods I do find it
confusing that the article states that the code below is an example of the
"recommended data binding approach in ASP 2.0".
Why is placing DAL level code and connection strings on every page that uses
data from a data store now the "recommended approach"?
The idea seems completely stupid on every level.
Richard
<%@ Page theme="SmokeAndGlass" %>
<html>
<head runat="server" />
<body>
<form runat="server">
<asp:TextBox runat="server" ID="EmpID" Text="3" />
<asp:button runat="server" Text="Refresh" />
<asp:SqlDataSource runat="server" ID="MySource"
ConnectionString="SERVER=(local);DATABASE=northwind;Integrated
Security=SSPI;"
DataSourceMode="DataSet"
SelectCommand="SELECT firstname, lastname FROM employees WHERE
employeeid > @MinID">
<SelectParameters>
<asp:ControlParameter Name="MinID" ControlId="EmpID"
PropertyName="Text" />
</SelectParameters>
</asp:SqlDataSource>
<asp:GridView runat="server" ID="grid"
DataSourceId="MySource"
AutoGenerateColumns="true">
</asp:GridView>
</form>
</body>
</html>