troubleshooting Question

Using a Gridview to populate a repeater using datakey

Avatar of Plowmister
Plowmister asked on
ASP.NET
5 Comments1 Solution2120 ViewsLast Modified:
Hi,
I am trying to use a Gridview to populate a repeater using the selected datakey.
I am using the same View query as there isnt a parent / child relationship here.
The grid is a summary and the repeater is the summary plus more detail...all from the same view though.

I keep getting the following error:
Data keys must be specified on GridView 'GridView2' before the selected data keys can be retrieved.  Use the DataKeyNames property to specify data keys.

I've tried many different things but none helped...
-------------------------
Here are the gridview settings:
<asp:GridView ID="GridView2"
 Visible="true"
 DataKeyNames="warehouseid,clientid"
  runat="server"
  autogeneratecolumns="false"
  DataSourceID="DataDisplay"
  EnableViewState="False"
  AllowSorting="True"
 AutoGenerateSelectButton="true"
  autogenerateeditbutton="false"
  EnableSortingAndPagingCallbacks="false"
  AllowPaging = "True"
  autogeneratedeletebutton="false"

--------------------------

Here is the repeater.
<asp:Repeater  DataSourceid="details" runat="server"
   ID="detailsrep" >
  <ItemTemplate>
  <%# Eval("clientname") %>
  </ItemTemplate>
   <ItemTemplate>
  <%# Eval("warehousid") %>
  </ItemTemplate>
  </asp:Repeater>
ASKER CERTIFIED SOLUTION
renjurdevan

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros