I'm attempting to print data from a gridview to a Dymo Label Printer via Client-side Scripting. I'm getting an error on line 9: "Object doesn't support this property or method". I'm trying to pull the data into a string value to feed to the printer function. Here is my page code:
Code:
<html xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml"[/URL] >
<head id="Head1" runat="server">
<script language=vbscript>
Sub Button1_onclick()
Dim DymoAddIn, DymoLabel
Dim strAddress
strAddress = DetailsView1.Rows(0).Cells(1).Text & vbCrLf & DetailsView1.Rows(1).Cells(1).Text & vbCrLf & DetailsView1.Rows(2).Cells(1).Text & ", " & DetailsView1.Rows(3).Cells(1).Text & DetailsView1.Rows(4).Cells(1).Text
DymoAddIn = CreateObject("DYMO.DymoAddIn")
DymoLabel = CreateObject("DYMO.DymoLabels")
DymoAddIn.Open("C:\Program Files\Dymo Label\Label Files\Address (30252,30320).LWL")
DymoLabel.SetAddress 1, strAddress
DymoAddIn.Print 1, False
End Sub
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<img src="images/TriS_logo_satisfaction_v2.jpg" />
<img src="images/guarantee_v2_01.jpg" />
</div>
<asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="~/App_Data/CBLAPP.mdb"
SelectCommand="SELECT [strMID], [strDBAName], [strDBAadd1], [strDBACity], [strDBAState], [strDBAZip] FROM [CBL_EOM_Data]">
</asp:AccessDataSource>
<table cols="2" style="width: 537px">
<tr>
<td style="width: 140px">
<asp:Label ID="MID" runat="server" Text="Enter Merchant ID Number:" Width="181px"></asp:Label></td>
<td style="width: 101px">
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" DataSourceID="AccessDataSource1"
DataTextField="strMID" DataValueField="strMID" Width="171px">
</asp:DropDownList></td>
</tr>
<tr>
<td style="height: 67px;" colspan="2">
<asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" DataSourceID="AccessDataSource2"
Height="50px" Width="510px">
<Fields>
<asp:BoundField DataField="strDBAName" HeaderText="Name" SortExpression="strDBAName" />
<asp:BoundField DataField="strDBAadd1" HeaderText="Address" SortExpression="strDBAadd1" />
<asp:BoundField DataField="strDBACity" HeaderText="City" SortExpression="strDBACity" />
<asp:BoundField DataField="strDBAState" HeaderText="State" SortExpression="strDBAState" />
<asp:BoundField DataField="strDBAZip" HeaderText="Zip" SortExpression="strDBAZip" />
</Fields>
</asp:DetailsView>
<asp:AccessDataSource ID="AccessDataSource2" runat="server" DataFile="~/App_Data/CBLAPP.mdb"
SelectCommand="SELECT [strDBAName], [strDBAadd1], [strDBACity], [strDBAState], [strDBAZip] FROM [CBL_EOM_Data] WHERE ([strMID] = ?)">
<SelectParameters>
<asp:ControlParameter ControlID="DropDownList1" Name="strMID" PropertyName="SelectedValue"
Type="String" />
</SelectParameters>
</asp:AccessDataSource>
</td>
</tr>
<tr><td style="text-align: center" colspan="2">
<Input type=Button Name="Button1" onclick="Button1_onclick()" Value="Print Label" /></td></tr>
</table>
</form>
</body>
</html>