利用ASP.NET Futures - Dynamic Data快速实现增删改,
关键代码:
Default.aspx
<%@ Page Language="IronPython" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%--
The following methods can be implemented for DynamicData controls:
GetColumns()
GetDetailsColumns()
GetRSSFields()
InitRow(row)
InitDataSource(dataSource)
--%>
<script runat="server">
def GetColumns():
return [
"Category",
"Title",
"Complete"
]
from System.Drawing import Color
def InitRow(row):
if "T" in Title:
row.BackColor = Color.Wheat
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
<link href="../style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<asp:DynamicRssLink ID="DynamicRssLink1" runat="server" />
<form id="form1" runat="server">
Category:
<asp:DropDownList ID="DropDownList1" runat="server" BackColor="yellow" Font-Bold="true">
</asp:DropDownList>
<asp:DynamicFilter ID="DynamicFilter2" runat="server" ColumnName="Category" ControlID="DropDownList1" FilterStyle="DropDown" />
Complete:
<asp:DynamicFilter ID="DynamicFilter1" ColumnName="Complete" runat="server" FilterStyle="DropDown" />
<br /><br />
<table border="0" cellpadding="0" cellspacing="0" style="width: 100%; height: 100%">
<tr>
<td align="left" valign="top"><asp:DynamicList ID="DynamicList1" runat="server" /><br /><br />
Add a task:
<asp:DynamicInsert ID="DynamicInsert1" runat="server" />
</td>
<td align="right" valign="top">Details:<asp:DynamicDetails ID="DynamicDetails1" runat="server" />
</td>
</tr>
</table>
</form>
</body>
</html>
<%@ Page Language="IronPython" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%--
The following methods can be implemented for DynamicData controls:
GetColumns()
GetDetailsColumns()
GetRSSFields()
InitRow(row)
InitDataSource(dataSource)
--%>
<script runat="server">
def GetColumns():
return [
"Category",
"Title",
"Complete"
]
from System.Drawing import Color
def InitRow(row):
if "T" in Title:
row.BackColor = Color.Wheat
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
<link href="../style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<asp:DynamicRssLink ID="DynamicRssLink1" runat="server" />
<form id="form1" runat="server">
Category:
<asp:DropDownList ID="DropDownList1" runat="server" BackColor="yellow" Font-Bold="true">
</asp:DropDownList>
<asp:DynamicFilter ID="DynamicFilter2" runat="server" ColumnName="Category" ControlID="DropDownList1" FilterStyle="DropDown" />
Complete:
<asp:DynamicFilter ID="DynamicFilter1" ColumnName="Complete" runat="server" FilterStyle="DropDown" />
<br /><br />
<table border="0" cellpadding="0" cellspacing="0" style="width: 100%; height: 100%">
<tr>
<td align="left" valign="top"><asp:DynamicList ID="DynamicList1" runat="server" /><br /><br />
Add a task:
<asp:DynamicInsert ID="DynamicInsert1" runat="server" />
</td>
<td align="right" valign="top">Details:<asp:DynamicDetails ID="DynamicDetails1" runat="server" />
</td>
</tr>
</table>
</form>
</body>
</html>