OK...This isn't my code, but one of our contractors.
We are having a debate about datagrids etc.
he has come up with the following in the ASPX page:
Then in the code behind he has:Code:<%@ Import Namespace="System.Data"%> <%@ Page Language="vb" AutoEventWireup="false" Codebehind="OrderRates.aspx.vb" Inherits="Test.OrderRates_Page" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <title>Order Rates</title> <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5"> <link rel="StyleSheet" href="../includes/TreeView/TreeView.css" type="text/css"> </HEAD> <body> <center> <form id="frmMain" method="post" runat="server"> <div id="Table_PropertyDiv" style="background-color: white;display: block;border:1px solid #cccccc;position:relative;height:400px;width:610px;word-wrap:break-word;overflow-y:scroll;"> <table width="600" class="panel" border="0" cellspacing="0" cellpadding="2"> <tr> <td width="75" class="panel" align="right" valign="middle" bgcolor="black"><b style="color:#FFFFFF"></b></td> <td width="75" class="panel" valign="middle" bgcolor="black"><b style="color:#FFFFFF">Code</b></td> <td width="75" class="panel" valign="middle" bgcolor="black"><b style="color:#FFFFFF">No.</b></td> <td width="75" class="panel" valign="middle" bgcolor="black"><b style="color:#FFFFFF">Cost</b></td> <td width="75" class="panel" valign="middle" bgcolor="black"><b style="color:#FFFFFF">Rate</b></td> <td width="75" class="panel" valign="middle" bgcolor="black"><b style="color:#FFFFFF">Description</b></td> <td width="75" class="panel" align="center" valign="middle" bgcolor="black"></td> </tr> <%if not gOrderNo="" then%> <%dt=GetOrderRates(gOrderNo)%> <%for each dr as DataRow in dt.Rows%> <%gCount=gCount+1%> <tr> <td width="75" class="panel" align="center" valign="middle"> <input name="Code_<%=gCount%>" value="<%=dr("Code")%>" type="text" width="75"> </td> <%if not gOrderNo="" then%> <td width="75" class="panel" align="center" valign="middle"> <input name="NoUnits_<%=gCount%>" value="<%=dr("NoUnits")%>" type="text" width="75"> </td> <%end if%> <td width="75" class="panel" align="center" valign="middle"> <input name="Price_<%=gCount%>" value="<%=dr("Price")%>" type="text" width="75"> </td> <td width="75" class="panel" align="center" valign="middle"> <input name="Rate_<%=gCount%>" value="<%=dr("Rate")%>" type="text" width="75"> </td> <td width="75" class="panel" align="center" valign="middle"> <input name="Description_<%=gCount%>" value="<%=dr("Description")%>" type="text" width="75"> </td> </tr> <%next%> <%end if%> </table> </div> </form> </center> </body> </HTML>
As you can see he has added VB code into the XML ASPX page.Code:Public Class OrderRates_Page Inherits Base_Page Protected gOrderNo As String Protected gCount As Integer Protected dt As DataTable Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load gOrderNo = Request("OrderNo") gOrderNo = "SOR00000001" End Sub Protected Function GetOrderRates(ByVal sOrderNo As String) As DataTable Dim sSQL As String sSQL = "SELECT * FROM OrderScheduleRates" & _ " where OrderNo='" & sOrderNo & "'" Return GetDataTable(sSQL) End Function End Class
No datagrids and binding here.
That's the code I am asking about.Code:<%if not gOrderNo="" then%> <%dt=GetOrderRates(gOrderNo)%> <%for each dr as DataRow in dt.Rows%> <%gCount=gCount+1%>
So...what do you think?
Any DISADVANTAGES from the above?
Woka


Reply With Quote
