Note that there are some explanatory texts on larger screens.

plurals
  1. POGridView Nested inside DataList
    primarykey
    data
    text
    <p>This seems like it should be an easy answer, but I have searched everywhere for this and can't seem to find what I am trying to do and i'm new to this so I might be missing something... Hopefully someone can help. </p> <p>The purpose of this is to display a packing list of scanners (the dl) I am sending for repair and each repair issue has notes (the gv). I am able to get the dl to display correctly, but i can't get the gv to display at all. Even when i hard code the "issuekey". I get an Object not set to object error. Obviously i can't keep it hard coded, so I try to pull the issuekey (via a DataKey)from the dl and pass it to the gv, I get "Index was out of range". (when i step thru it comes up -1).</p> <p>Here is the code i'm working with.... THANKS</p> <pre><code>Sub LoadShippingList() dlShippingList.DataSource = WarehouseManager.GetScannerIssuesByScannerStatus(WarehouseManager.ScannerStatus.PendingShipForRepair) dlShippingList.DataBind() End Sub Protected Sub dlShippingList_ItemDataBound(sender As Object, e As System.Web.UI.WebControls.DataListItemEventArgs) Handles dlShippingList.ItemDataBound Dim dList As DataList = CType(sender, DataList) Dim intScannerIssueKey As Integer = dList.DataKeys(e.Item.ItemIndex) Dim gv As GridView gv = CType(e.Item.FindControl("gvShippingListIssueNotes"), GridView) gv.DataSource() = WarehouseManager.GetScannerIssueNotes(intScannerIssueKey) gv.DataBind() End Sub &lt;asp:Panel ID="pnlShippingList" runat="server"&gt; &lt;asp:Label ID="lblShippingListCaption" runat="server" Text="Shipping List" SkinID="PageTitle"&gt;&lt;/asp:Label&gt; &lt;br /&gt; &lt;asp:DataList ID="dlShippingList" runat="server" GridLines="Both" DataKeys="ScannerIssueKey" DataKeyField="ScannerIssueKey"&gt; &lt;HeaderTemplate&gt; &lt;table&gt; &lt;tr&gt; &lt;td&gt; &lt;asp:Label ID="lblShipmentNumberCaption" runat="server" Text="Shipment:" SkinID="FieldLabel"&gt;&lt;/asp:Label&gt; &lt;/td&gt; &lt;td&gt; &lt;asp:Label ID="lblShipmentNumber" runat="server" SkinID="FeedbackMessageSmallDark"&gt;&lt;/asp:Label&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; &lt;asp:Label ID="lblShipmentDateCaption" runat="server" Text="Date:" SkinID="FieldLabel"&gt;&lt;/asp:Label&gt; &lt;/td&gt; &lt;td&gt; &lt;asp:Label ID="ShipmentDate" runat="server" SkinID="FeedbackMessageSmallDark"&gt;&lt;/asp:Label&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/HeaderTemplate&gt; &lt;ItemTemplate&gt; Issue #:&lt;asp:Label ID="lblScannerIssueKey" runat="server" Text='&lt;%# Eval("ScannerIssueKey") %&gt;'&gt;&lt;/asp:Label&gt; Scanner #: &lt;asp:Label ID="Label1" runat="server" Text='&lt;%# Eval("ScannerKey") %&gt;'&gt;&lt;/asp:Label&gt; Subject:&lt;asp:Label ID="Label2" runat="server" Text='&lt;%# Eval("IssueDescription") %&gt;'&gt;&lt;/asp:Label&gt; &lt;br /&gt; Notes:&lt;br /&gt; &lt;asp:GridView ID="gvShippingListIssueNotes" HorizontalAlign="Left" runat="server" Font-Size="Medium" EmptyDataText="No Notes" AutoGenerateColumns="false" SkinID="SimpleGrid"&gt; &lt;RowStyle VerticalAlign="Top" HorizontalAlign="Center" /&gt; &lt;Columns&gt; &lt;asp:BoundField HeaderText="Notes" DataField="Notes" /&gt; &lt;asp:BoundField HeaderText="User" DataField="UserEntered" /&gt; &lt;asp:BoundField HeaderText="Date" DataField="DateAndTime" /&gt; &lt;/Columns&gt; &lt;/asp:GridView&gt; &lt;br /&gt; &lt;/ItemTemplate&gt; &lt;FooterTemplate&gt; Weissmans's 6750 Manchester Avenue St. Louis MO 63139&lt;/FooterTemplate&gt; &lt;/asp:DataList&gt; &lt;br /&gt; &lt;/asp:Panel&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload