Datalist控件EditItemTemplate问题,救命!
比如在datalist1中的ItemTemplate中放一个按扭,点之后要求出现EditItemTemplate模块,请问代码怎么写如果我把这个按扭的commandNam...
比如在datalist1中的ItemTemplate中放一个按扭,点之后要求出现EditItemTemplate模块,请问代码怎么写
如果我把这个按扭的commandName设置为edit,代码如下
protected void DataList1_EditCommand(object source, DataListCommandEventArgs e)
{
//设置DataList1控件的编辑项的索引为选择的当前索引
DataList1.EditItemIndex = e.Item.ItemIndex;
//数据绑定
Bind();
}
对吗?我照书做可是做不出 郁闷死了 请大侠们教教 在线等
可是web develop 2008里datalist编辑模式下有item template模块 edit template模块了 还要添加?怎么甜加?代码我不懂 我是用加控件的方式做的 展开
如果我把这个按扭的commandName设置为edit,代码如下
protected void DataList1_EditCommand(object source, DataListCommandEventArgs e)
{
//设置DataList1控件的编辑项的索引为选择的当前索引
DataList1.EditItemIndex = e.Item.ItemIndex;
//数据绑定
Bind();
}
对吗?我照书做可是做不出 郁闷死了 请大侠们教教 在线等
可是web develop 2008里datalist编辑模式下有item template模块 edit template模块了 还要添加?怎么甜加?代码我不懂 我是用加控件的方式做的 展开
3个回答
展开全部
你要添加一个EditTemplate模块的~~
就是在前台页面上增加一个如下的模块
<asp:DataList ID="DataList1" runat="server" RepeatDirection="Horizontal" RepeatColumns="3"
DataKeyField="CustomerID" DataSourceID="DataListCustomerDataSources" CellPadding="4"
ForeColor="#333333" OnEditCommand="DataList1_EditCommand" OnCancelCommand="DataList1_CancelCommand"
OnUpdateCommand="DataList1_UpdateCommand" OnDeleteCommand="DataList1_DeleteCommand">
<ItemTemplate>
CustomerID:
<asp:Label ID="CustomerIDLabel" runat="server" Text='<%# Eval("CustomerID") %>'>
</asp:Label><br />
CompanyName:
<asp:Label ID="CompanyNameLabel" runat="server" Text='<%# Eval("CompanyName") %>'>
</asp:Label><br />
ContactName:
<asp:Label ID="ContactNameLabel" runat="server" Text='<%# Eval("ContactName") %>'>
</asp:Label><br />
ContactTitle:
<asp:Label ID="ContactTitleLabel" runat="server" Text='<%# Eval("ContactTitle") %>'>
</asp:Label><br />
Address:
<asp:Label ID="AddressLabel" runat="server" Text='<%# Eval("Address") %>'></asp:Label><br />
City:
<asp:Label ID="CityLabel" runat="server" Text='<%# Eval("City") %>'></asp:Label><br />
Region:
<asp:Label ID="RegionLabel" runat="server" Text='<%# Eval("Region") %>'></asp:Label><br />
PostalCode:
<asp:Label ID="PostalCodeLabel" runat="server" Text='<%# Eval("PostalCode") %>'>
</asp:Label><br />
Country:
<asp:Label ID="CountryLabel" runat="server" Text='<%# Eval("Country") %>'></asp:Label><br />
Phone:
<asp:Label ID="PhoneLabel" runat="server" Text='<%# Eval("Phone") %>'></asp:Label><br />
Fax:
<asp:Label ID="FaxLabel" runat="server" Text='<%# Eval("Fax") %>'></asp:Label><br />
<br />
<asp:Button ID="ItemEditButton" runat="server" Text="Edit" CommandName="edit" />
<asp:Button ID="ItemDeleteButton" runat="server" Text="Delete" CommandName="delete" />
</ItemTemplate>
<EditItemTemplate>
CustomerID:
<asp:TextBox ID="CustomerIDTextBox" runat="server" Text='<%# Eval("CustomerID") %>'
ReadOnly="true">
</asp:TextBox><br />
CompanyName:
<asp:TextBox ID="CompanyNameTextBox" runat="server" Text='<%# Eval("CompanyName") %>'>
</asp:TextBox><br />
ContactName:
<asp:TextBox ID="ContactNameTextBox" runat="server" Text='<%# Eval("ContactName") %>'>
</asp:TextBox><br />
ContactTitle:
<asp:TextBox ID="ContactTitleTextBox" runat="server" Text='<%# Eval("ContactTitle") %>'>
</asp:TextBox><br />
Address:
<asp:TextBox ID="AddressTextBox" runat="server" Text='<%# Eval("Address") %>'></asp:TextBox><br />
City:
<asp:TextBox ID="CityTextBox" runat="server" Text='<%# Eval("City") %>'></asp:TextBox><br />
Region:
<asp:TextBox ID="RegionTextBox" runat="server" Text='<%# Eval("Region") %>'></asp:TextBox><br />
PostalCode:
<asp:TextBox ID="PostalCodeTextBox" runat="server" Text='<%# Eval("PostalCode") %>'>
</asp:TextBox><br />
Country:
<asp:TextBox ID="CountryTextBox" runat="server" Text='<%# Eval("Country") %>'></asp:TextBox><br />
Phone:
<asp:TextBox ID="PhoneTextBox" runat="server" Text='<%# Eval("Phone") %>'></asp:TextBox><br />
Fax:
<asp:TextBox ID="FaxTextBox" runat="server" Text='<%# Eval("Fax") %>'></asp:TextBox><br />
<br />
<asp:Button ID="ItemSaveButton" runat="server" Text="Save" CommandName="update" />
<asp:Button ID="ItemCancelButton" runat="server" Text="Cancel" CommandName="cancel" />
</EditItemTemplate>
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<AlternatingItemStyle BackColor="White" />
<ItemStyle BackColor="#EFF3FB" />
<SelectedItemStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
</asp:DataList>
就是在前台页面上增加一个如下的模块
<asp:DataList ID="DataList1" runat="server" RepeatDirection="Horizontal" RepeatColumns="3"
DataKeyField="CustomerID" DataSourceID="DataListCustomerDataSources" CellPadding="4"
ForeColor="#333333" OnEditCommand="DataList1_EditCommand" OnCancelCommand="DataList1_CancelCommand"
OnUpdateCommand="DataList1_UpdateCommand" OnDeleteCommand="DataList1_DeleteCommand">
<ItemTemplate>
CustomerID:
<asp:Label ID="CustomerIDLabel" runat="server" Text='<%# Eval("CustomerID") %>'>
</asp:Label><br />
CompanyName:
<asp:Label ID="CompanyNameLabel" runat="server" Text='<%# Eval("CompanyName") %>'>
</asp:Label><br />
ContactName:
<asp:Label ID="ContactNameLabel" runat="server" Text='<%# Eval("ContactName") %>'>
</asp:Label><br />
ContactTitle:
<asp:Label ID="ContactTitleLabel" runat="server" Text='<%# Eval("ContactTitle") %>'>
</asp:Label><br />
Address:
<asp:Label ID="AddressLabel" runat="server" Text='<%# Eval("Address") %>'></asp:Label><br />
City:
<asp:Label ID="CityLabel" runat="server" Text='<%# Eval("City") %>'></asp:Label><br />
Region:
<asp:Label ID="RegionLabel" runat="server" Text='<%# Eval("Region") %>'></asp:Label><br />
PostalCode:
<asp:Label ID="PostalCodeLabel" runat="server" Text='<%# Eval("PostalCode") %>'>
</asp:Label><br />
Country:
<asp:Label ID="CountryLabel" runat="server" Text='<%# Eval("Country") %>'></asp:Label><br />
Phone:
<asp:Label ID="PhoneLabel" runat="server" Text='<%# Eval("Phone") %>'></asp:Label><br />
Fax:
<asp:Label ID="FaxLabel" runat="server" Text='<%# Eval("Fax") %>'></asp:Label><br />
<br />
<asp:Button ID="ItemEditButton" runat="server" Text="Edit" CommandName="edit" />
<asp:Button ID="ItemDeleteButton" runat="server" Text="Delete" CommandName="delete" />
</ItemTemplate>
<EditItemTemplate>
CustomerID:
<asp:TextBox ID="CustomerIDTextBox" runat="server" Text='<%# Eval("CustomerID") %>'
ReadOnly="true">
</asp:TextBox><br />
CompanyName:
<asp:TextBox ID="CompanyNameTextBox" runat="server" Text='<%# Eval("CompanyName") %>'>
</asp:TextBox><br />
ContactName:
<asp:TextBox ID="ContactNameTextBox" runat="server" Text='<%# Eval("ContactName") %>'>
</asp:TextBox><br />
ContactTitle:
<asp:TextBox ID="ContactTitleTextBox" runat="server" Text='<%# Eval("ContactTitle") %>'>
</asp:TextBox><br />
Address:
<asp:TextBox ID="AddressTextBox" runat="server" Text='<%# Eval("Address") %>'></asp:TextBox><br />
City:
<asp:TextBox ID="CityTextBox" runat="server" Text='<%# Eval("City") %>'></asp:TextBox><br />
Region:
<asp:TextBox ID="RegionTextBox" runat="server" Text='<%# Eval("Region") %>'></asp:TextBox><br />
PostalCode:
<asp:TextBox ID="PostalCodeTextBox" runat="server" Text='<%# Eval("PostalCode") %>'>
</asp:TextBox><br />
Country:
<asp:TextBox ID="CountryTextBox" runat="server" Text='<%# Eval("Country") %>'></asp:TextBox><br />
Phone:
<asp:TextBox ID="PhoneTextBox" runat="server" Text='<%# Eval("Phone") %>'></asp:TextBox><br />
Fax:
<asp:TextBox ID="FaxTextBox" runat="server" Text='<%# Eval("Fax") %>'></asp:TextBox><br />
<br />
<asp:Button ID="ItemSaveButton" runat="server" Text="Save" CommandName="update" />
<asp:Button ID="ItemCancelButton" runat="server" Text="Cancel" CommandName="cancel" />
</EditItemTemplate>
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<AlternatingItemStyle BackColor="White" />
<ItemStyle BackColor="#EFF3FB" />
<SelectedItemStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
</asp:DataList>
威孚半导体技术
2024-08-19 广告
2024-08-19 广告
威孚(苏州)半导体技术有限公司是一家专注生产、研发、销售晶圆传输设备整机模块(EFEM/SORTER)及核心零部件的高科技半导体公司。公司核心团队均拥有多年半导体行业从业经验,其中技术团队成员博士、硕士学历占比80%以上,依托丰富的软件底层...
点击进入详情页
本回答由威孚半导体技术提供
展开全部
你要添加一个EditTemplate模块的~~
就是在前台页面上增加一个如下的模块
<asp:DataList
ID="DataList1"
runat="server"
RepeatDirection="Horizontal"
RepeatColumns="3"
DataKeyField="CustomerID"
DataSourceID="DataListCustomerDataSources"
CellPadding="4"
ForeColor="#333333"
OnEditCommand="DataList1_EditCommand"
OnCancelCommand="DataList1_CancelCommand"
OnUpdateCommand="DataList1_UpdateCommand"
OnDeleteCommand="DataList1_DeleteCommand">
<ItemTemplate>
CustomerID:
<asp:Label
ID="CustomerIDLabel"
runat="server"
Text='<%#
Eval("CustomerID")
%>'>
</asp:Label><br
/>
CompanyName:
<asp:Label
ID="CompanyNameLabel"
runat="server"
Text='<%#
Eval("CompanyName")
%>'>
</asp:Label><br
/>
ContactName:
<asp:Label
ID="ContactNameLabel"
runat="server"
Text='<%#
Eval("ContactName")
%>'>
</asp:Label><br
/>
ContactTitle:
<asp:Label
ID="ContactTitleLabel"
runat="server"
Text='<%#
Eval("ContactTitle")
%>'>
</asp:Label><br
/>
Address:
<asp:Label
ID="AddressLabel"
runat="server"
Text='<%#
Eval("Address")
%>'></asp:Label><br
/>
City:
<asp:Label
ID="CityLabel"
runat="server"
Text='<%#
Eval("City")
%>'></asp:Label><br
/>
Region:
<asp:Label
ID="RegionLabel"
runat="server"
Text='<%#
Eval("Region")
%>'></asp:Label><br
/>
PostalCode:
<asp:Label
ID="PostalCodeLabel"
runat="server"
Text='<%#
Eval("PostalCode")
%>'>
</asp:Label><br
/>
Country:
<asp:Label
ID="CountryLabel"
runat="server"
Text='<%#
Eval("Country")
%>'></asp:Label><br
/>
Phone:
<asp:Label
ID="PhoneLabel"
runat="server"
Text='<%#
Eval("Phone")
%>'></asp:Label><br
/>
Fax:
<asp:Label
ID="FaxLabel"
runat="server"
Text='<%#
Eval("Fax")
%>'></asp:Label><br
/>
<br
/>
<asp:Button
ID="ItemEditButton"
runat="server"
Text="Edit"
CommandName="edit"
/>
<asp:Button
ID="ItemDeleteButton"
runat="server"
Text="Delete"
CommandName="delete"
/>
</ItemTemplate>
<EditItemTemplate>
CustomerID:
<asp:TextBox
ID="CustomerIDTextBox"
runat="server"
Text='<%#
Eval("CustomerID")
%>'
ReadOnly="true">
</asp:TextBox><br
/>
CompanyName:
<asp:TextBox
ID="CompanyNameTextBox"
runat="server"
Text='<%#
Eval("CompanyName")
%>'>
</asp:TextBox><br
/>
ContactName:
<asp:TextBox
ID="ContactNameTextBox"
runat="server"
Text='<%#
Eval("ContactName")
%>'>
</asp:TextBox><br
/>
ContactTitle:
<asp:TextBox
ID="ContactTitleTextBox"
runat="server"
Text='<%#
Eval("ContactTitle")
%>'>
</asp:TextBox><br
/>
Address:
<asp:TextBox
ID="AddressTextBox"
runat="server"
Text='<%#
Eval("Address")
%>'></asp:TextBox><br
/>
City:
<asp:TextBox
ID="CityTextBox"
runat="server"
Text='<%#
Eval("City")
%>'></asp:TextBox><br
/>
Region:
<asp:TextBox
ID="RegionTextBox"
runat="server"
Text='<%#
Eval("Region")
%>'></asp:TextBox><br
/>
PostalCode:
<asp:TextBox
ID="PostalCodeTextBox"
runat="server"
Text='<%#
Eval("PostalCode")
%>'>
</asp:TextBox><br
/>
Country:
<asp:TextBox
ID="CountryTextBox"
runat="server"
Text='<%#
Eval("Country")
%>'></asp:TextBox><br
/>
Phone:
<asp:TextBox
ID="PhoneTextBox"
runat="server"
Text='<%#
Eval("Phone")
%>'></asp:TextBox><br
/>
Fax:
<asp:TextBox
ID="FaxTextBox"
runat="server"
Text='<%#
Eval("Fax")
%>'></asp:TextBox><br
/>
<br
/>
<asp:Button
ID="ItemSaveButton"
runat="server"
Text="Save"
CommandName="update"
/>
<asp:Button
ID="ItemCancelButton"
runat="server"
Text="Cancel"
CommandName="cancel"
/>
</EditItemTemplate>
<FooterStyle
BackColor="#507CD1"
Font-Bold="True"
ForeColor="White"
/>
<AlternatingItemStyle
BackColor="White"
/>
<ItemStyle
BackColor="#EFF3FB"
/>
<SelectedItemStyle
BackColor="#D1DDF1"
Font-Bold="True"
ForeColor="#333333"
/>
<HeaderStyle
BackColor="#507CD1"
Font-Bold="True"
ForeColor="White"
/>
</asp:DataList>
就是在前台页面上增加一个如下的模块
<asp:DataList
ID="DataList1"
runat="server"
RepeatDirection="Horizontal"
RepeatColumns="3"
DataKeyField="CustomerID"
DataSourceID="DataListCustomerDataSources"
CellPadding="4"
ForeColor="#333333"
OnEditCommand="DataList1_EditCommand"
OnCancelCommand="DataList1_CancelCommand"
OnUpdateCommand="DataList1_UpdateCommand"
OnDeleteCommand="DataList1_DeleteCommand">
<ItemTemplate>
CustomerID:
<asp:Label
ID="CustomerIDLabel"
runat="server"
Text='<%#
Eval("CustomerID")
%>'>
</asp:Label><br
/>
CompanyName:
<asp:Label
ID="CompanyNameLabel"
runat="server"
Text='<%#
Eval("CompanyName")
%>'>
</asp:Label><br
/>
ContactName:
<asp:Label
ID="ContactNameLabel"
runat="server"
Text='<%#
Eval("ContactName")
%>'>
</asp:Label><br
/>
ContactTitle:
<asp:Label
ID="ContactTitleLabel"
runat="server"
Text='<%#
Eval("ContactTitle")
%>'>
</asp:Label><br
/>
Address:
<asp:Label
ID="AddressLabel"
runat="server"
Text='<%#
Eval("Address")
%>'></asp:Label><br
/>
City:
<asp:Label
ID="CityLabel"
runat="server"
Text='<%#
Eval("City")
%>'></asp:Label><br
/>
Region:
<asp:Label
ID="RegionLabel"
runat="server"
Text='<%#
Eval("Region")
%>'></asp:Label><br
/>
PostalCode:
<asp:Label
ID="PostalCodeLabel"
runat="server"
Text='<%#
Eval("PostalCode")
%>'>
</asp:Label><br
/>
Country:
<asp:Label
ID="CountryLabel"
runat="server"
Text='<%#
Eval("Country")
%>'></asp:Label><br
/>
Phone:
<asp:Label
ID="PhoneLabel"
runat="server"
Text='<%#
Eval("Phone")
%>'></asp:Label><br
/>
Fax:
<asp:Label
ID="FaxLabel"
runat="server"
Text='<%#
Eval("Fax")
%>'></asp:Label><br
/>
<br
/>
<asp:Button
ID="ItemEditButton"
runat="server"
Text="Edit"
CommandName="edit"
/>
<asp:Button
ID="ItemDeleteButton"
runat="server"
Text="Delete"
CommandName="delete"
/>
</ItemTemplate>
<EditItemTemplate>
CustomerID:
<asp:TextBox
ID="CustomerIDTextBox"
runat="server"
Text='<%#
Eval("CustomerID")
%>'
ReadOnly="true">
</asp:TextBox><br
/>
CompanyName:
<asp:TextBox
ID="CompanyNameTextBox"
runat="server"
Text='<%#
Eval("CompanyName")
%>'>
</asp:TextBox><br
/>
ContactName:
<asp:TextBox
ID="ContactNameTextBox"
runat="server"
Text='<%#
Eval("ContactName")
%>'>
</asp:TextBox><br
/>
ContactTitle:
<asp:TextBox
ID="ContactTitleTextBox"
runat="server"
Text='<%#
Eval("ContactTitle")
%>'>
</asp:TextBox><br
/>
Address:
<asp:TextBox
ID="AddressTextBox"
runat="server"
Text='<%#
Eval("Address")
%>'></asp:TextBox><br
/>
City:
<asp:TextBox
ID="CityTextBox"
runat="server"
Text='<%#
Eval("City")
%>'></asp:TextBox><br
/>
Region:
<asp:TextBox
ID="RegionTextBox"
runat="server"
Text='<%#
Eval("Region")
%>'></asp:TextBox><br
/>
PostalCode:
<asp:TextBox
ID="PostalCodeTextBox"
runat="server"
Text='<%#
Eval("PostalCode")
%>'>
</asp:TextBox><br
/>
Country:
<asp:TextBox
ID="CountryTextBox"
runat="server"
Text='<%#
Eval("Country")
%>'></asp:TextBox><br
/>
Phone:
<asp:TextBox
ID="PhoneTextBox"
runat="server"
Text='<%#
Eval("Phone")
%>'></asp:TextBox><br
/>
Fax:
<asp:TextBox
ID="FaxTextBox"
runat="server"
Text='<%#
Eval("Fax")
%>'></asp:TextBox><br
/>
<br
/>
<asp:Button
ID="ItemSaveButton"
runat="server"
Text="Save"
CommandName="update"
/>
<asp:Button
ID="ItemCancelButton"
runat="server"
Text="Cancel"
CommandName="cancel"
/>
</EditItemTemplate>
<FooterStyle
BackColor="#507CD1"
Font-Bold="True"
ForeColor="White"
/>
<AlternatingItemStyle
BackColor="White"
/>
<ItemStyle
BackColor="#EFF3FB"
/>
<SelectedItemStyle
BackColor="#D1DDF1"
Font-Bold="True"
ForeColor="#333333"
/>
<HeaderStyle
BackColor="#507CD1"
Font-Bold="True"
ForeColor="White"
/>
</asp:DataList>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
你要添加一个EditTemplate模块的~~
就是在前台页面上增加一个如下的模块
<asp:DataList
ID="DataList1"
runat="server"
RepeatDirection="Horizontal"
RepeatColumns="3"
DataKeyField="CustomerID"
DataSourceID="DataListCustomerDataSources"
CellPadding="4"
ForeColor="#333333"
OnEditCommand="DataList1_EditCommand"
OnCancelCommand="DataList1_CancelCommand"
OnUpdateCommand="DataList1_UpdateCommand"
OnDeleteCommand="DataList1_DeleteCommand">
<ItemTemplate>
CustomerID:
<asp:Label
ID="CustomerIDLabel"
runat="server"
Text='<%#
Eval("CustomerID")
%>'>
</asp:Label><br
/>
CompanyName:
<asp:Label
ID="CompanyNameLabel"
runat="server"
Text='<%#
Eval("CompanyName")
%>'>
</asp:Label><br
/>
ContactName:
<asp:Label
ID="ContactNameLabel"
runat="server"
Text='<%#
Eval("ContactName")
%>'>
</asp:Label><br
/>
ContactTitle:
<asp:Label
ID="ContactTitleLabel"
runat="server"
Text='<%#
Eval("ContactTitle")
%>'>
</asp:Label><br
/>
Address:
<asp:Label
ID="AddressLabel"
runat="server"
Text='<%#
Eval("Address")
%>'></asp:Label><br
/>
City:
<asp:Label
ID="CityLabel"
runat="server"
Text='<%#
Eval("City")
%>'></asp:Label><br
/>
Region:
<asp:Label
ID="RegionLabel"
runat="server"
Text='<%#
Eval("Region")
%>'></asp:Label><br
/>
PostalCode:
<asp:Label
ID="PostalCodeLabel"
runat="server"
Text='<%#
Eval("PostalCode")
%>'>
</asp:Label><br
/>
Country:
<asp:Label
ID="CountryLabel"
runat="server"
Text='<%#
Eval("Country")
%>'></asp:Label><br
/>
Phone:
<asp:Label
ID="PhoneLabel"
runat="server"
Text='<%#
Eval("Phone")
%>'></asp:Label><br
/>
Fax:
<asp:Label
ID="FaxLabel"
runat="server"
Text='<%#
Eval("Fax")
%>'></asp:Label><br
/>
<br
/>
<asp:Button
ID="ItemEditButton"
runat="server"
Text="Edit"
CommandName="edit"
/>
<asp:Button
ID="ItemDeleteButton"
runat="server"
Text="Delete"
CommandName="delete"
/>
</ItemTemplate>
<EditItemTemplate>
CustomerID:
<asp:TextBox
ID="CustomerIDTextBox"
runat="server"
Text='<%#
Eval("CustomerID")
%>'
ReadOnly="true">
</asp:TextBox><br
/>
CompanyName:
<asp:TextBox
ID="CompanyNameTextBox"
runat="server"
Text='<%#
Eval("CompanyName")
%>'>
</asp:TextBox><br
/>
ContactName:
<asp:TextBox
ID="ContactNameTextBox"
runat="server"
Text='<%#
Eval("ContactName")
%>'>
</asp:TextBox><br
/>
ContactTitle:
<asp:TextBox
ID="ContactTitleTextBox"
runat="server"
Text='<%#
Eval("ContactTitle")
%>'>
</asp:TextBox><br
/>
Address:
<asp:TextBox
ID="AddressTextBox"
runat="server"
Text='<%#
Eval("Address")
%>'></asp:TextBox><br
/>
City:
<asp:TextBox
ID="CityTextBox"
runat="server"
Text='<%#
Eval("City")
%>'></asp:TextBox><br
/>
Region:
<asp:TextBox
ID="RegionTextBox"
runat="server"
Text='<%#
Eval("Region")
%>'></asp:TextBox><br
/>
PostalCode:
<asp:TextBox
ID="PostalCodeTextBox"
runat="server"
Text='<%#
Eval("PostalCode")
%>'>
</asp:TextBox><br
/>
Country:
<asp:TextBox
ID="CountryTextBox"
runat="server"
Text='<%#
Eval("Country")
%>'></asp:TextBox><br
/>
Phone:
<asp:TextBox
ID="PhoneTextBox"
runat="server"
Text='<%#
Eval("Phone")
%>'></asp:TextBox><br
/>
Fax:
<asp:TextBox
ID="FaxTextBox"
runat="server"
Text='<%#
Eval("Fax")
%>'></asp:TextBox><br
/>
<br
/>
<asp:Button
ID="ItemSaveButton"
runat="server"
Text="Save"
CommandName="update"
/>
<asp:Button
ID="ItemCancelButton"
runat="server"
Text="Cancel"
CommandName="cancel"
/>
</EditItemTemplate>
<FooterStyle
BackColor="#507CD1"
Font-Bold="True"
ForeColor="White"
/>
<AlternatingItemStyle
BackColor="White"
/>
<ItemStyle
BackColor="#EFF3FB"
/>
<SelectedItemStyle
BackColor="#D1DDF1"
Font-Bold="True"
ForeColor="#333333"
/>
<HeaderStyle
BackColor="#507CD1"
Font-Bold="True"
ForeColor="White"
/>
</asp:DataList>
就是在前台页面上增加一个如下的模块
<asp:DataList
ID="DataList1"
runat="server"
RepeatDirection="Horizontal"
RepeatColumns="3"
DataKeyField="CustomerID"
DataSourceID="DataListCustomerDataSources"
CellPadding="4"
ForeColor="#333333"
OnEditCommand="DataList1_EditCommand"
OnCancelCommand="DataList1_CancelCommand"
OnUpdateCommand="DataList1_UpdateCommand"
OnDeleteCommand="DataList1_DeleteCommand">
<ItemTemplate>
CustomerID:
<asp:Label
ID="CustomerIDLabel"
runat="server"
Text='<%#
Eval("CustomerID")
%>'>
</asp:Label><br
/>
CompanyName:
<asp:Label
ID="CompanyNameLabel"
runat="server"
Text='<%#
Eval("CompanyName")
%>'>
</asp:Label><br
/>
ContactName:
<asp:Label
ID="ContactNameLabel"
runat="server"
Text='<%#
Eval("ContactName")
%>'>
</asp:Label><br
/>
ContactTitle:
<asp:Label
ID="ContactTitleLabel"
runat="server"
Text='<%#
Eval("ContactTitle")
%>'>
</asp:Label><br
/>
Address:
<asp:Label
ID="AddressLabel"
runat="server"
Text='<%#
Eval("Address")
%>'></asp:Label><br
/>
City:
<asp:Label
ID="CityLabel"
runat="server"
Text='<%#
Eval("City")
%>'></asp:Label><br
/>
Region:
<asp:Label
ID="RegionLabel"
runat="server"
Text='<%#
Eval("Region")
%>'></asp:Label><br
/>
PostalCode:
<asp:Label
ID="PostalCodeLabel"
runat="server"
Text='<%#
Eval("PostalCode")
%>'>
</asp:Label><br
/>
Country:
<asp:Label
ID="CountryLabel"
runat="server"
Text='<%#
Eval("Country")
%>'></asp:Label><br
/>
Phone:
<asp:Label
ID="PhoneLabel"
runat="server"
Text='<%#
Eval("Phone")
%>'></asp:Label><br
/>
Fax:
<asp:Label
ID="FaxLabel"
runat="server"
Text='<%#
Eval("Fax")
%>'></asp:Label><br
/>
<br
/>
<asp:Button
ID="ItemEditButton"
runat="server"
Text="Edit"
CommandName="edit"
/>
<asp:Button
ID="ItemDeleteButton"
runat="server"
Text="Delete"
CommandName="delete"
/>
</ItemTemplate>
<EditItemTemplate>
CustomerID:
<asp:TextBox
ID="CustomerIDTextBox"
runat="server"
Text='<%#
Eval("CustomerID")
%>'
ReadOnly="true">
</asp:TextBox><br
/>
CompanyName:
<asp:TextBox
ID="CompanyNameTextBox"
runat="server"
Text='<%#
Eval("CompanyName")
%>'>
</asp:TextBox><br
/>
ContactName:
<asp:TextBox
ID="ContactNameTextBox"
runat="server"
Text='<%#
Eval("ContactName")
%>'>
</asp:TextBox><br
/>
ContactTitle:
<asp:TextBox
ID="ContactTitleTextBox"
runat="server"
Text='<%#
Eval("ContactTitle")
%>'>
</asp:TextBox><br
/>
Address:
<asp:TextBox
ID="AddressTextBox"
runat="server"
Text='<%#
Eval("Address")
%>'></asp:TextBox><br
/>
City:
<asp:TextBox
ID="CityTextBox"
runat="server"
Text='<%#
Eval("City")
%>'></asp:TextBox><br
/>
Region:
<asp:TextBox
ID="RegionTextBox"
runat="server"
Text='<%#
Eval("Region")
%>'></asp:TextBox><br
/>
PostalCode:
<asp:TextBox
ID="PostalCodeTextBox"
runat="server"
Text='<%#
Eval("PostalCode")
%>'>
</asp:TextBox><br
/>
Country:
<asp:TextBox
ID="CountryTextBox"
runat="server"
Text='<%#
Eval("Country")
%>'></asp:TextBox><br
/>
Phone:
<asp:TextBox
ID="PhoneTextBox"
runat="server"
Text='<%#
Eval("Phone")
%>'></asp:TextBox><br
/>
Fax:
<asp:TextBox
ID="FaxTextBox"
runat="server"
Text='<%#
Eval("Fax")
%>'></asp:TextBox><br
/>
<br
/>
<asp:Button
ID="ItemSaveButton"
runat="server"
Text="Save"
CommandName="update"
/>
<asp:Button
ID="ItemCancelButton"
runat="server"
Text="Cancel"
CommandName="cancel"
/>
</EditItemTemplate>
<FooterStyle
BackColor="#507CD1"
Font-Bold="True"
ForeColor="White"
/>
<AlternatingItemStyle
BackColor="White"
/>
<ItemStyle
BackColor="#EFF3FB"
/>
<SelectedItemStyle
BackColor="#D1DDF1"
Font-Bold="True"
ForeColor="#333333"
/>
<HeaderStyle
BackColor="#507CD1"
Font-Bold="True"
ForeColor="White"
/>
</asp:DataList>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询