Hey Everyone,
This is what i want to do with my website. I want to pull data from an access query and and load it into a listview table. The user will sort through the data on the website and remove the rows she doesn't want. After the user is done, they will click a send button that will email the data to the appropriate party. I hope this makes sense.
Here is what i have so far. I have read the access query data into a data table. I have the list view table built, but I am unsure how bind the data table into the listview table. Is this the best route to go? Will binding the datatable to the listview table allow the user to delete rows out of the datatable? I think if i figure this out, then the rest of the website I can do quickly.
Here is the vb.net code behind:
Protected Sub btnView_Click(sender As Object, e As System.EventArgs) Handles btnView.Click
Dim query As New QueryBuilder.SelectQuery("qryVendorReport")
'Fill data table with vendor information
Dim sample As String = ""
Dim results As New DataTable
results = (db.fillTable(query.toSelectQuery))
'Bind data to listview
End Sub
Here is the Listview i built:
<asp:ListView ID="lv" runat="server" DataSourceID="lvDataSource" InsertItemPosition="LastItem">
<LayoutTemplate>
<div class="lvSkinny">
<br style="clear: both;">
<table class="Table" rules="none" cellpadding="3" cellspacing="0">
<thead>
<tr>
<th>
<asp:LinkButton ID="lnkVendor_Email" CommandName="Sort" CommandArgument="Vendor_Email"
runat="server">Vendor Email</asp:LinkButton>
</th>
<th>
</th>
</tr>
</thead>
<tbody>
<asp:PlaceHolder runat="server" ID="itemPlaceholder" />
</tbody>
</table>
<asp:DataPager ID="pager" runat="server" PageSize="20" PagedControlID="lv">
<Fields>
<asp:NumericPagerField />
</Fields>
</asp:DataPager>
</div>
</LayoutTemplate>
<ItemTemplate>
<tr class="Row">
<td>
<%# Eval("Vendor_Email")%>
</td>
<td>
<asp:LinkButton ID="LinkButton1" CommandName="Edit" runat="server">Edit</asp:LinkButton>
</td>
</tr>
</ItemTemplate>
<AlternatingItemTemplate>
<tr class="AltRow">
<td>
<%# Eval("Vendor_Email")%>
</td>
<td>
<asp:LinkButton ID="LinkButton1" CommandName="Edit" runat="server">Edit</asp:LinkButton>
</td>
</tr>
</AlternatingItemTemplate>
<EditItemTemplate>
<td>
<%# Eval("Vendor_Email")%>
</td>
<td>
<asp:LinkButton ID="Update" CommandName="UpdateRow" CommandArgument='<%#Eval("Engine_Line") %>'
runat="server">Update</asp:LinkButton>
<asp:LinkButton ID="Cancel" CommandName="CancelEdit" runat="server">Cancel</asp:LinkButton>
</td>
</EditItemTemplate>
<InsertItemTemplate>
<td>
<asp:TextBox ID="txtVendor_Email" runat="server" Width="100"></asp:TextBox>
</td>
<td>
<asp:LinkButton ID="Insert" CommandName="InsertRow" runat="server">Insert</asp:LinkButton>
</td>
</InsertItemTemplate>
</asp:ListView>
<br style="clear: both;" />
<asp:SqlDataSource ID="lvDataSource" runat="server" ProviderName="System.Data.OleDb">
</asp:SqlDataSource>
So I need to figure out how to bind the results datatable to lvdatasource. I tried a few different ways to do this with no luck. Maybe the syntax I trying to use is incorrect.