Click here to Skip to main content
15,890,845 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want the button in every row and when i click the button i want one textbox



XML
<%@ 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>
Posted
Comments
koool.kabeer 6-Aug-10 5:09am    
where do you want the TextBox?..
and where do you want the Button?...
we are not selling Buttons or Textboxes(kidding)....
but try to be more cleared

1 solution

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.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900