CodeSmith - NetTier 对于主从表级联显示的SAMPLE -- ObjectDataSource

None.gif using  System;
None.gif
using  System.Data;
None.gif
using  System.Configuration;
None.gif
using  System.Collections;
None.gif
using  System.Web;
None.gif
using  System.Web.Security;
None.gif
using  System.Web.UI;
None.gif
using  System.Web.UI.WebControls;
None.gif
using  System.Web.UI.WebControls.WebParts;
None.gif
using  System.Web.UI.HtmlControls;
None.gif
None.gif
public  partial  class  PurchaseModule_PurchaseRequestCreate : System.Web.UI.Page
ExpandedBlockStart.gifContractedBlock.gif
dot.gif {
InBlock.gif    
protected void Page_Load(object sender, EventArgs e)
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
InBlock.gif
ExpandedSubBlockEnd.gif    }

InBlock.gif    
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
InBlock.gif       
InBlock.gif
ExpandedSubBlockEnd.gif    }

InBlock.gif    
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
InBlock.gif        
if (e.Row.RowIndex > -1)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            SqlDataSource objDS 
= e.Row.FindControl("SqlDataSource1"as SqlDataSource;
InBlock.gif            objDS.SelectParameters[
"Param1"].DefaultValue = e.Row.Cells[0].Text;
ExpandedSubBlockEnd.gif        }

ExpandedSubBlockEnd.gif    }

ExpandedBlockEnd.gif}

None.gif
前台页面案例
ExpandedBlockStart.gif ContractedBlock.gif <% dot.gif @ Page Language="C#" AutoEventWireup="true" CodeFile="PurchaseRequestCreate.aspx.cs" Inherits="PurchaseModule_PurchaseRequestCreate"  %>
None.gif
None.gif
<! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
None.gif
None.gif
< html  xmlns ="http://www.w3.org/1999/xhtml"   >
None.gif
< head  runat ="server" >
None.gif    
< title > 无标题页 </ title >
None.gif
</ head >
None.gif
< body >
None.gif    
< form  id ="form1"  runat ="server" >
None.gif        
< asp:GridView  ID ="GridView1"  runat ="server"  AutoGenerateColumns ="False"  BackColor ="#CCCCCC"
None.gif            BorderColor
="#999999"  BorderStyle ="Solid"  BorderWidth ="3px"  CellPadding ="4"  CellSpacing ="2"
None.gif            DataKeyNames
="RequestID"  DataSourceID ="PurchaseRequestDataSource1"  ForeColor ="Black"
None.gif            OnRowDataBound
="GridView1_RowDataBound" >
None.gif            
< FooterStyle  BackColor ="#CCCCCC"   />
None.gif            
< Columns >
None.gif                
< asp:BoundField  DataField ="RequestID"  HeaderText ="流水号"  InsertVisible ="False"
None.gif                    ReadOnly
="True"  SortExpression ="RequestID"   />
None.gif                
< asp:BoundField  DataField ="RequestCode"  HeaderText ="申请号码"  SortExpression ="RequestCode"   />
None.gif                
< asp:BoundField  DataField ="ReleaseCode"  HeaderText ="审核状态"  SortExpression ="ReleaseCode"   />
None.gif                
< asp:BoundField  DataField ="Requestor"  HeaderText ="申请人"  SortExpression ="Requestor"   />
None.gif                
< asp:BoundField  DataField ="RequestDepartmentID"  HeaderText ="申请部门"
None.gif                    SortExpression
="RequestDepartmentID"   />
None.gif                
< asp:BoundField  DataField ="RequestDate"  HeaderText ="申请日期"  SortExpression ="RequestDate"   />
None.gif                
< asp:BoundField  DataField ="Desc1"  HeaderText ="备注"  SortExpression ="Desc1"   />
None.gif                
< asp:TemplateField  HeaderText ="采购明细" >
None.gif                    
< ItemTemplate >
None.gif                        
&nbsp;
None.gif                        
< asp:SqlDataSource  ID ="SqlDataSource1"  runat ="server"  ConnectionString ="<%$ ConnectionStrings:BLUEBEANSConnectionString %>"
None.gif                            SelectCommand
="SELECT * FROM PurchaseRequestItem WHERE (RequestID = @Param1)" >
None.gif                            
< SelectParameters >
None.gif                                
< asp:Parameter  Name ="Param1"   />
None.gif                            
</ SelectParameters >
None.gif                        
</ asp:SqlDataSource >
None.gif                        
< asp:DetailsView  ID ="DetailsView2"  runat ="server"  AutoGenerateRows ="False"  BackColor ="White"
None.gif                            BorderColor
="White"  BorderStyle ="Ridge"  BorderWidth ="2px"  CellPadding ="3"  CellSpacing ="1"
None.gif                            DataSourceID
="SqlDataSource1"  GridLines ="None"  Height ="50px"  Width ="125px" >
None.gif                            
< FooterStyle  BackColor ="#C6C3C6"  ForeColor ="Black"   />
None.gif                            
< EditRowStyle  BackColor ="#9471DE"  Font-Bold ="True"  ForeColor ="White"   />
None.gif                            
< RowStyle  BackColor ="#DEDFDE"  ForeColor ="Black"   />
None.gif                            
< PagerStyle  BackColor ="#C6C3C6"  ForeColor ="Black"  HorizontalAlign ="Right"   />
None.gif                            
< Fields >
None.gif                                
< asp:BoundField  DataField ="RequestID"  HeaderText ="RequestID"  SortExpression ="RequestID"  Visible ="False"   />
None.gif                                
< asp:BoundField  DataField ="ProductName"  HeaderText ="采购物品"  SortExpression ="ProductName"   />
None.gif                                
< asp:BoundField  DataField ="ProductID"  HeaderText ="ProductID"  SortExpression ="ProductID"  Visible ="False"   />
None.gif                                
< asp:BoundField  DataField ="Unit"  HeaderText ="单位"  SortExpression ="Unit"   />
None.gif                                
< asp:BoundField  DataField ="Amount"  HeaderText ="采购量"  SortExpression ="Amount"   />
None.gif                                
< asp:BoundField  DataField ="ReceivedAmount"  HeaderText ="接收量"  SortExpression ="ReceivedAmount"   />
None.gif                                
< asp:BoundField  DataField ="VendorName"  HeaderText ="供应商"  SortExpression ="VendorName"   />
None.gif                            
</ Fields >
None.gif                            
< HeaderStyle  BackColor ="#4A3C8C"  Font-Bold ="True"  ForeColor ="#E7E7FF"   />
None.gif                        
</ asp:DetailsView >
None.gif                    
</ ItemTemplate >
None.gif                
</ asp:TemplateField >
None.gif                
< asp:CommandField  ShowEditButton ="True"   />
None.gif                
< asp:CommandField  ShowDeleteButton ="True"   />
None.gif            
</ Columns >
None.gif            
< RowStyle  BackColor ="White"   />
None.gif            
< SelectedRowStyle  BackColor ="#000099"  Font-Bold ="True"  ForeColor ="White"   />
None.gif            
< PagerStyle  BackColor ="#CCCCCC"  ForeColor ="Black"  HorizontalAlign ="Left"   />
None.gif            
< HeaderStyle  BackColor ="Black"  Font-Bold ="True"  ForeColor ="White"   />
None.gif        
</ asp:GridView >
None.gif        
&nbsp;   &nbsp;&nbsp;
None.gif        
< data:PurchaseRequestDataSource  ID ="PurchaseRequestDataSource"  runat ="server"  SelectMethod ="GetByRequestID" >
None.gif            
< Parameters >
None.gif                
< asp:QueryStringParameter  Name ="RequestID"  QueryStringField ="RequestID"  Type ="String"   />
None.gif            
</ Parameters >
None.gif        
</ data:PurchaseRequestDataSource >
None.gif        
< data:PurchaseRequestDataSource  ID ="PurchaseRequestDataSource1"  runat ="server"  SelectMethod ="GetAll" >
None.gif        
</ data:PurchaseRequestDataSource >
None.gif        
< data:DepartmentDataSource  ID ="DepartmentDataSource"  runat ="server"  EnablePaging ="True"
None.gif            EnableSorting
="True"  SelectMethod ="GetPaged" >
None.gif            
< Parameters >
None.gif            
</ Parameters >
None.gif        
</ data:DepartmentDataSource >
None.gif        
< data:PurchaseRequestTypeDataSource  ID ="RequestTypeIDPurchaseRequestTypeDataSource"
None.gif            runat
="server"  SelectMethod ="GetAll" >
None.gif        
</ data:PurchaseRequestTypeDataSource >
None.gif        
< br  />
None.gif        
< data:PurchaseRequestItemDataSource  ID ="PurchaseRequestItemDataSource"  runat ="server"
None.gif            EnablePaging
="True"  EnableSorting ="True"  SelectMethod ="GetPaged" >
None.gif            
< Parameters >
None.gif                
< data:CustomParameter  ConvertEmptyStringToNull ="false"  Name ="WhereClause"  Value =""   />
None.gif                
< data:CustomParameter  ConvertEmptyStringToNull ="false"  Name ="OrderByClause"  Value =""   />
None.gif                
< asp:ControlParameter  ControlID ="GridView1"  Name ="PageIndex"  PropertyName ="PageIndex"
None.gif                    Type
="Int32"   />
None.gif                
< asp:ControlParameter  ControlID ="GridView1"  Name ="PageSize"  PropertyName ="PageSize"
None.gif                    Type
="Int32"   />
None.gif                
< data:CustomParameter  Name ="RecordCount"  Type ="Int32"  Value ="0"   />
None.gif            
</ Parameters >
None.gif        
</ data:PurchaseRequestItemDataSource >
None.gif    
</ form >
None.gif
</ body >
None.gif
</ html >
None.gif
数据库设计


UI显示效果


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值