DetailsView的内置编辑功能怎么用?
我现在获取了一个表的信息我想使用内置的编辑功能直接进行DetailsView内的数据编辑但是不知道这个东西怎么写 求解 --------------------编程问答--------------------
--------------------编程问答-------------------- protected void DetailsView1_ItemUpdated(object sender, DetailsViewUpdatedEventArgs e)
<asp:DetailsView ID="DetailsView1" runat="server" DataSourceID="ObjectDataSource1"
Width="100%" CellPadding="0" GridLines="None" AutoGenerateRows="False">
<Fields>
<asp:TemplateField ShowHeader="False">
<ItemTemplate>
里面放要显示的信息
比如:<asp:Label ID="lblCon_Name" runat="server" Text='<%# Eval("Con_Name") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
里面放要编辑的信息
<asp:TextBox ID="txtCon_Name" runat="server" Text='<%# Bind("Con_Name") %>' Width="70%"></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField ShowHeader="False">
<EditItemTemplate>
<div class="Button_Center">
<asp:Button ID="LinkButton1" runat="server" CausesValidation="True" CommandName="Update"
Text="更新"></asp:Button>
<asp:Button ID="LinkButton2" runat="server" CausesValidation="False" CommandName="Cancel"
Text="取消"></asp:Button></div>
</EditItemTemplate>
<ItemTemplate>
<div class="Button_Center">
<asp:Button ID="LinkButton1" runat="server" CausesValidation="False" CommandName="Edit"
Text="编辑"></asp:Button></div>
</ItemTemplate>
</asp:TemplateField>
</Fields>
<RowStyle BackColor="PaleGoldenrod" />
</asp:DetailsView>
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" TypeName="ADOnline.Bll.BContract"
SelectMethod="GetModel" DataObjectTypeName="ADOnline.Model.Contract" UpdateMethod="Update"
OnUpdating="Updating">
<SelectParameters>
<asp:QueryStringParameter Name="Contract_ID" QueryStringField="Contract_ID" Type="Int32" />
</SelectParameters>
</asp:ObjectDataSource>
{
DetailsView myDetailsView = (DetailsView)(sender);
}
if (DetailsView1.CurrentMode == DetailsViewMode.Edit)//编辑模式
{
string b = ((TextBox)DetailsView1.FindControl("TextBox1")).Text;
}
--------------------编程问答--------------------
补充:.NET技术 , ASP.NET