Click here to Skip to main content
15,895,777 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i am using gridview control in my web application,and fill it up using following code.
C#
protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
                this.BindGrid();
            }
        }

        private void BindGrid()
        {
            Entities entities = new Entities();
           
                GridView1.DataSource = from customer in entities.DutyPoints.ToList()
                                       select customer;
            
                GridView1.DataBind();
           
        }

and aspx code is
ASP.NET
<asp:TemplateField HeaderText="Name" ItemStyle-Width="150">
        <ItemTemplate>
            <asp:Label ID="lblName" runat="server" Text='<%# Eval("Description") %>'></asp:Label>
        </ItemTemplate>
        <EditItemTemplate>
            <asp:TextBox ID="txtName" runat="server" Text='<%# Eval("Description") %>'></asp:TextBox>
        </EditItemTemplate>
<ItemTemplate>
            <asp:Label ID="lblEmp" runat="server" Text='<%# Eval("Employee") %>'></asp:Label>
        </ItemTemplate>
<asp:dropdownlist id="Employee"></asp:dropdownlist>
    </asp:TemplateField>

it return all list ok,but my requirement is that against each DutyPoint ,there is may be two or three Employees to work on,i want description to display one time if there are more than one employee at that point?
C#
dutyPoint    Employee
xxx           Emplist
              Emplist
              Emplist

how it is possible?
Posted
Comments
Abdul Samad KP 4-Sep-15 5:34am    
You can use a gridview inside your gridview and bind the child gridview on databind event of the parent grid, or you can use a datarpeater control
Sinisa Hajnal 4-Sep-15 6:06am    
Or have separate grid on the side or under main grid (or in a floating panel) and fill it on row selection. I would do either floatin panel (aka tooltip) or as Abdul suggested, child grid. Good luck
sreeyush sudhakaran 6-Sep-15 2:05am    
Just Edit Template of your gridview and do proper databinding...

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