在数据列表的每一行中的页脚中添加按钮 [英] Add the button in footer in every row in datalist
本文介绍了在数据列表的每一行中的页脚中添加按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我希望每一行都有该按钮,当我单击该按钮时,我想要一个文本框
I want the button in every row and when i click the button i want one textbox
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:DataList ID="DataList1" runat="server">
<HeaderTemplate>orkut</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox ID="c1" runat="server" />
<img src='<%#Eval("pic") %>' height="90" width="70" />
<asp:Label ID="l1" runat="server" Text='<%#Eval("name") %>'></asp:Label>
<asp:TextBox ID="t1" runat ="server" Text='<%#Eval("message") %>'></asp:TextBox>
</ItemTemplate>
<%--<EditItemTemplate>
<asp:TextBox ID="t1" runat="server" Text="santhu"></asp:TextBox>
</EditItemTemplate>--%>
<FooterTemplate>
<asp:Button ID="b1" runat="server" Text="reply" />
</FooterTemplate>
</asp:DataList>
<asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False"
DataSourceID="SqlDataSource1" Height="50px" Width="125px">
<Fields>
<asp:BoundField DataField="name" HeaderText="name" SortExpression="name" />
<asp:BoundField DataField="pic" HeaderText="pic" SortExpression="pic" />
<asp:BoundField DataField="message" HeaderText="message"
SortExpression="message" />
<asp:CommandField InsertText="reply" ShowInsertButton="True" />
<asp:ButtonField CommandName="Insert" HeaderText="reply" ShowHeader="True"
Text="Button" />
<asp:CommandField ShowEditButton="True" />
<asp:TemplateField></asp:TemplateField>
<asp:ImageField>
</asp:ImageField>
</Fields>
</asp:DetailsView>
<asp:DataList ID="DataList2" runat="server" BackColor="White"
BorderColor="#999999" BorderStyle="Solid" BorderWidth="1px" CellPadding="3"
DataSourceID="SqlDataSource1" ForeColor="Black" GridLines="Vertical">
<FooterStyle BackColor="#CCCCCC" />
<ItemTemplate>
name:
<asp:Label ID="nameLabel" runat="server" Text='<%# Eval("name") %>' />
<br />
pic:
<asp:Label ID="picLabel" runat="server" Text='<%# Eval("pic") %>' />
<br />
message:
<asp:Label ID="messageLabel" runat="server" Text='<%# Eval("message") %>' />
<br />
<br />
</ItemTemplate>
<AlternatingItemStyle BackColor="#CCCCCC" />
<SelectedItemStyle BackColor="#000099" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
</asp:DataList>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:santhuConnectionString %>"
SelectCommand="SELECT * FROM [sa]"></asp:SqlDataSource>
</div>
</form>
</body>
</html>
推荐答案
ConnectionStrings:santhuConnectionString %> " span> =" 选择*来自[sa]" < /asp:SqlDataSource > < /div > < /form > < /body > < /html >
ConnectionStrings:santhuConnectionString %>" SelectCommand="SELECT * FROM [sa]"></asp:SqlDataSource> </div> </form> </body> </html>
在项目模板中,您可以添加一个按钮,使其出现在每一行中.您必须设计表格,然后将表格添加到itemtemplate中.
In item template you can add a button so that it will appear in the each row. You have to design the table & then add the table in the itemtemplate.
这篇关于在数据列表的每一行中的页脚中添加按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文