In aspx page:
<%@ Page Language="VB" AutoEventWireup = "false" CodeFile="~/MainPage.aspx.vb" Inherits="Mainpage" %>
<%@ Import Namespace="System.Linq" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Label Page</title>
<script type="text/javascript">
//-------------------------------------------------------------
// Select all the checkboxes (Hotmail style)
//-------------------------------------------------------------
function SelectAllCheckboxes(spanChk){
// Added as ASPX uses SPAN for checkbox
var oItem = spanChk.children;
var theBox=oItem.item(0)
xState=theBox.checked;
elm=theBox.form.elements;
for(i=0;i<elm.length;i++)
if(elm[i].type=="checkbox" && elm[i].id!=theBox.id)
{
//elm[i].click();
if(elm[i].checked!=xState)
elm[i].click();
//elm[i].checked=xState;
}
}
//-------------------------------------------------------------
//----Select highlight rows when the checkboxes are selected
//
//-------------------------------------------------------------
function HighlightRow(chkB) {
var oItem = chkB.children;
xState=oItem.item(0).checked;
if(xState)
{chkB.parentElement.parentElement.style.backgroundColor='lightblue';
// grdEmployees.SelectedItemStyle.BackColor
chkB.parentElement.parentElement.style.color='white';
// grdEmployees.SelectedItemStyle.ForeColor
}else
{chkB.parentElement.parentElement.style.backgroundColor='white';
//grdEmployees.ItemStyle.BackColor
chkB.parentElement.parentElement.style.color='black';
//grdEmployees.ItemStyle.ForeColor
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<br />
<asp:RadioButton ID="rbIIEbl" runat="server" Checked="True" />
<asp:Label ID="lblIIELbl" runat="server"
Text="Interior / Intermediate and External Labels"></asp:Label>
<br />
<asp:RadioButton ID="rbMSLbl" runat="server" Checked="True" />
<asp:Label ID="lblMSLbl" runat="server" Text="Material Shipping Label"></asp:Label>
</div>
<p style="margin-left: 60px">
<asp:Label ID="DelNumLabel" runat="server" Text="Delivery Number"></asp:Label>
<asp:TextBox ID="txtbxDelNum" runat="server" ToolTip="Enter Delivery Order Number">
</asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ErrorMessage="Delivery Number is a required field." ControlToValidate="txtbxDelNum" >
</asp:RequiredFieldValidator>
<asp:LinkButton ID="CreateFile" runat="server">Create label file</asp:LinkButton>
</p>
<asp:CheckBox id="chkAll"
onclick="javascript:SelectAllCheckboxes(this);" runat="server"
AutoPostBack="false" ToolTip="Select/Deselect All" />
<asp:GridView ID="DataGV" runat="server" AutoGenerateColumns="False" cellpadding="4"
GridLines="Horizontal" BackColor="White" BorderColor="#336666" BorderStyle="Double"
BorderWidth="3px" Font-Bold="True" Font-Names="Verdana" Font-Size="X-Small" Height="1px"
Width="100%" AllowSorting="True" HorizontalAlign="Center" AllowPaging="True">
<RowStyle BackColor="White" ForeColor="#333333" />
<Columns>
<asp:TemplateField HeaderText="Select">
<ItemTemplate>
<asp:CheckBox ID="chkSelect" onclick="javascript:HighlightRow(this);"
runat="server" OnCheckedChanged= "grdEmployees_CheckedChanged"
Checked="True" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField runat="server" HeaderText="Line Number" SortExpression="lineNumber"
Text="<%# DataBinder.Eval(Container.DataItem, "LINE_NUMBER") %>"
DataField="Line_Number">
</asp:BoundField >
<asp:BoundField runat="server" HeaderText="End Unit UID Number" SortExpression="UIDNumber"
Text="<%# DataBinder.Eval(Container.DataItem, "UID_No") %>"
DataField="UID_NO">
</asp:BoundField>
</Columns>
<AlternatingRowStyle BackColor="Silver" />
<FooterStyle BackColor="#009900" Font-Bold="True" ForeColor="White" Font-Size="Small" HorizontalAlign="Right" />
<PagerSettings PageButtonCount="30" Mode="NumericFirstLast" NextPageText="" PreviousPageText="" Position="TopAndBottom" />
<PagerStyle BackColor="Silver" ForeColor="White" HorizontalAlign="Center" Font-Names="Verdana" Font-Size="Small" />
</asp:GridView>
</form>
</body>
</html>
In aspx.vb page:
Protected Sub GetShipInfo(ByVal DelNum As String)
Dim myDataSet As New ShipHdrShipLinesUID
Dim ShipHdrDA As New ShipHdrShipLinesUIDTableAdapters.ShipHdrTableAdapter
Dim ShipLinesDA As New ShipHdrShipLinesUIDTableAdapters.ShipLinesTableAdapter
Dim UIDDA As New ShipHdrShipLinesUIDTableAdapters.UIDTableAdapter
Try
ShipHdrDA.Fill(myDataSet.ShipHdr, DelNum)
ShipLinesDA.Fill(myDataSet.ShipLines, shipment_id)
UIDDA.Fill(myDataSet.UID, shipment_id)
DataGV.DataSource = myDataSet.Tables("ShipLines")
DataGV.DataSource = myDataSet.Tables("UID")
DataGV.DataBind()
Catch ex As Exception
Dim Util = New Utilities()
Util.LogError(System.Reflection.MethodBase.GetCurrentMethod(), "Error obtaining shipping and line item data records.", ex)
Throw New Exception(" ")
End Try
End Sub
Get a Quick Start on Data Access with ADO.NET
http://www.asp101.com/articles/jay/adodotnet/default.asp