Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
.aspx

ASP.NET
<asp:GridView ID="gvRepeter" AutoGenerateColumns="false" AllowPaging="true" runat="server"
                                Width="100%" OnRowDataBound="gvRepeter_RowDataBound" 
                                onsorting="gvRepeter_Sorting">
                                <columns>
                                    <asp:BoundField HeaderText="#">
                                        <HeaderStyle Width="2%" CssClass="alternate_heading" />
                                        <itemstyle horizontalalign="Right" />
                                    
                                    <asp:TemplateField>
                                        <itemtemplate>
                                            <asp:Repeater ID="rpEmpSearch" runat="server" OnItemCommand="rpEmpSearch_ItemCommand" 
                                            DataSource='<%#DataBinder.Eval(Container,"DataItem") %>'>
                                                <itemtemplate>
                                                    <table class="extAlternate_row1 tblRepeater" style="width: 100%;">
                                                        <tr>
                                                            <td>
                                                                <div>
                                                                    Organisation Name:
                                                                    <asp:Label ID="lblOrgName" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "OrganisationName")%>'>
                                                                    
                                                                </div>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                <div>
                                                                    Location:
                                                                    <asp:Label ID="lblLocation" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Location")%>'>
                                                                    
                                                                </div>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                <div>
                                                                    Industry Type:
                                                                    <asp:Label ID="lblIndustry" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "IndustryType")%>'>
                                                                    
                                                                </div>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                <div>
                                                                    Website:
                                                                    <asp:Label ID="lblWebsite" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Website")%>'>
                                                                    
                                                                </div>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                <div>
                                                                    Address:
                                                                    <asp:Label ID="lblAddress" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Address")%>'>
                                                                    
                                                                </div>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                <div>
                                                                    Email Address:
                                                                    <asp:Label ID="lblEmail" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Email")%>'>
                                                                    
                                                                </div>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                <div>
                                                                    Contact Number:
                                                                    <asp:Label ID="lblContact" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "ContactNo")%>'>
                                                                    
                                                                </div>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                <div style="float: right;">
                                                                    <asp:LinkButton ID="lnlViewDetail" runat="server" CommandName="View Detail" CommandArgument='<%#Eval("Id") %>'>
                                                    View Detail
                                                                </div>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </itemtemplate>
                                                <alternatingitemtemplate>
                                                    <table class="extAlternate_row2 tblRepeater" style="width: 100%;">
                                                        <tr>
                                                            <td>
                                                                <div>
                                                                    Organisation Name:
                                                                    <asp:Label ID="lblOrgName" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "OrganisationName")%>'>
                                                                    
                                                                </div>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                <div>
                                                                    Location:
                                                                    <asp:Label ID="lblLocation" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Location")%>'>
                                                                    
                                                                </div>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                <div>
                                                                    Industry Type:
                                                                    <asp:Label ID="lblIndustry" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "IndustryType")%>'>
                                                                    
                                                                </div>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                <div>
                                                                    Website:
                                                                    <asp:Label ID="lblWebsite" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Website")%>'>
                                                                    
                                                                </div>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                <div>
                                                                    Address:
                                                                    <asp:Label ID="lblAddress" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Address")%>'>
                                                                    
                                                                </div>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                <div>
                                                                    Email Address:
                                                                    <asp:Label ID="lblEmail" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Email")%>'>
                                                                    
                                                                </div>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                <div>
                                                                    Contact Number:
                                                                    <asp:Label ID="lblContact" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "ContactNo")%>'>
                                                                    
                                                                </div>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                <div style="float: right;">
                                                                    <asp:LinkButton ID="lnlViewDetail" runat="server" CommandName="View Detail" CommandArgument='<%#Eval("Id") %>'>
                                                    View Detail
                                                                </div>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </alternatingitemtemplate>
                                            
                                        </itemtemplate>
                                    
                                </columns>





Here I am having a gridview inside which i have taken repeater control But ,Whenever i bind my gridview nothing is displayed


Here is my code
C#
var query = (from t in context.Employer
                join c in context.EmployerContactDetails on t.ID equals c.EmployerID
                join s in context.SubClass on t.NICCodeNew equals s.ID
                where c.AddressTypeID == (int)enmAddressType.MainBranchOffice
                select new
                {
                    Id = t.ID,
                    OrganisationName = pageLanguage == enmLanguage.English ? t.OrganisationName : t.OrganisationNameRegional,
                    LocationID = t.LocationID,
                    Location = pageLanguage == enmLanguage.English ? t.Location.Name : t.Location.NameRegional,
                    IndustryType = pageLanguage == enmLanguage.English ? s.Name : s.NameRegional,
                    Website = t.Website,
                    Address = c.Address,
                    Email = c.EmailAddress1 == "" ? c.EmailAddress2 : c.EmailAddress1,
                    ContactNo = c.Phone1 == null ? c.Phone2 : c.Phone1,
                    Sector = t.PrimarySectorID,
                    OrganisationType = t.OrganisationTypeID,
                    EmpTotal = t.TotalEmployees
                }).Distinct();



What is the mistake i am doing ..Please Help
Posted
Updated 18-Jun-14 19:39pm
v4
Comments
Debabrata_Das 19-Jun-14 1:42am    
Hi Neha, it seems like few closing tags are missing from your aspx code that you shared here.
One more thing, can you please help me understanding the requirement of having a repeater control within a GridView?
- DD
King Fisher 19-Jun-14 2:13am    
does your query return any Values? or getting any Error?

you can bind the repeater in itemdatabound event of gridview.It will work
 
Share this answer
 
You need to bind your data with repeater separately.
 
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