怎么在业务逻辑层调不到DetailsView回发的参数

tangxinzitxz 2010-07-16 11:57:26
<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="DetailsView.aspx.cs" Inherits="DetailsView" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" DataSourceID="ObjectDataSource1"
Height="257px" Width="498px" BackColor="LightGoldenrodYellow" BorderColor="Tan" BorderWidth="1px" CellPadding="2" ForeColor="Black" GridLines="None" >
<Fields>
<asp:TemplateField HeaderText="工资" SortExpression="Intsalary">
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Intsalary") %>'></asp:TextBox>
</EditItemTemplate>
<InsertItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Intsalary") %>'></asp:TextBox>
</InsertItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("Intsalary") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="员工姓名" SortExpression="EmployeeName">
<EditItemTemplate>
<asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("EmployeeName") %>'></asp:TextBox>
</EditItemTemplate>
<InsertItemTemplate>
<asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("EmployeeName") %>'></asp:TextBox>
</InsertItemTemplate>
<ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%# Bind("EmployeeName") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="部门" SortExpression="Departaent">
<EditItemTemplate>
 <asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="ObjectDataSource1"
DataTextField="DepartaentName1" DataValueField="Id" SelectedIndex='<%# (int)Eval("Departaent.Id")-1 %>'>

</asp:DropDownList>
<asp:HiddenField ID="HiddenField1" runat="server" Value='<%# Eval("Departaent.Id") %>' />
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="getALLDe"
TypeName="BLL.EmployeeManager"></asp:ObjectDataSource>
</EditItemTemplate>
<InsertItemTemplate>
<asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("Departaent") %>'></asp:TextBox>
</InsertItemTemplate>
<ItemTemplate>
<asp:Label ID="Label3" runat="server" Text='<%# Eval("Departaent.DepartaentName1") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="地址" SortExpression="Address">
<EditItemTemplate>
<asp:TextBox ID="TextBox4" runat="server" Text='<%# Bind("Address") %>'></asp:TextBox>
</EditItemTemplate>
<InsertItemTemplate>
<asp:TextBox ID="TextBox4" runat="server" Text='<%# Bind("Address") %>'></asp:TextBox>
</InsertItemTemplate>
<ItemTemplate>
<asp:Label ID="Label4" runat="server" Text='<%# Bind("Address") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="备注" SortExpression="Remark">
<EditItemTemplate>
<asp:TextBox ID="TextBox5" runat="server" Text='<%# Bind("Remark") %>'></asp:TextBox>
</EditItemTemplate>
<InsertItemTemplate>
<asp:TextBox ID="TextBox5" runat="server" Text='<%# Bind("Remark") %>'></asp:TextBox>
</InsertItemTemplate>
<ItemTemplate>
<asp:Label ID="Label5" runat="server" Text='<%# Bind("Remark") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:CommandField ShowEditButton="True" />
<asp:BoundField DataField="EmployeeId" HeaderText="EmployeeId" SortExpression="EmployeeId" InsertVisible="False" Visible="False" />
</Fields>
<FooterStyle BackColor="Tan" />
<EditRowStyle BackColor="DarkSlateBlue" ForeColor="GhostWhite" />
<PagerStyle BackColor="PaleGoldenrod" ForeColor="DarkSlateBlue" HorizontalAlign="Center" />
<HeaderStyle BackColor="Tan" Font-Bold="True" />
<AlternatingRowStyle BackColor="PaleGoldenrod" />
</asp:DetailsView>
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="GetallById"
TypeName="BLL.EmployeeManager" UpdateMethod="updateEmployee">
<SelectParameters>
<asp:QueryStringParameter Name="id" QueryStringField="id" Type="Int32" />
</SelectParameters>
<UpdateParameters>
<asp:Parameter Name="Departaent" Type="Int32" />
<asp:Parameter Name="EmployeeName" Type="String" />
<asp:Parameter Name="Intsalary" Type="Int32" />
<asp:Parameter Name="Address" Type="String" />
<asp:Parameter Name="Remark" Type="String" />
<asp:Parameter Name="EmployeeId" Type="Int32" />
</UpdateParameters>
</asp:ObjectDataSource>
</asp:Content>

...全文
14 点赞 收藏 3
写回复
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
后浪 2010-07-17
是编辑状态时候吗?
cs文件代码贴下看看啊!
回复
navysky 2010-07-17
好长啊,帮你顶一下
回复
tangxinzitxz 2010-07-17
public static void updateEmployee(int Departaent, string EmployeeName, int Intsalary, string Address, string Remark, int EmployeeId)
{
EmployeeService.updateEmployee(Departaent, EmployeeName, Intsalary, Address, Remark, EmployeeId);
}


就是Departaent 和 EmployeeId取不到,其他的能取得到。。。
回复
发动态
发帖子
ASP
创建于2007-09-28

2.8w+

社区成员

ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
申请成为版主
社区公告
暂无公告