原創|使用教程|編輯:龔雪|2015-12-11 15:32:27.000|閱讀 401 次
概述:Barcode Professional for ASP.NET是Neodynamic公司的一款.NET服務器控件,本文將展示如何用Barcode Professional for ASP.NET實現ASP.NET移動網站條碼的添加。含有C#和VB兩種參考代碼。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關鏈接:
需求:
可通過Barcode Professional 的ASP.NET Mobile技術輕松創建Mobile WebForms,從而實現移動設備上條碼的顯示。
【Barcode Professional for ASP.NET最新下載】
可以根據以下步驟進行操作:
1.創建ASP.NET網站。
2.添加引用Neodynamic.WebControls.BarcodeProfessional.dll程序集。
3.打開web.config 文件并在httpHandlers節點添加下列條目。
<configuration> <system.web> <httpHandlers> <add verb="*" path="BarcodeGen.axd" type="Neodynamic.WebControls.BarcodeProfessional.BarcodeProfessional, Neodynamic.WebControls.BarcodeProfessional"/> </httpHandlers> </system.web> </configuration>
4.添加一個"Mobile Web Form"項目并將其看起來像下圖一樣設計,你也可以直接從源代碼粘貼復制。
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="MobileVB.aspx.vb" Inherits="MobileVB" %> <%@ Register TagPrefix="mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile" %> <html xmlns="//www.w3.org/1999/xhtml" > <body> <mobile:Form id="Form1" runat="server"><mobile:Label ID="Label1" Runat="server">Barcode Gen</mobile:Label> <mobile:Image ID="Image1" Runat="server" Visible="False"> </mobile:Image> <mobile:Label ID="Label2" Runat="server">Value To Encode:</mobile:Label> <mobile:TextBox ID="TextBox1" Runat="server"> </mobile:TextBox><mobile:SelectionList ID="SelectionList1" Runat="server" SelectType="Radio"> <Item Selected="True" Text="Code128" Value="Code128" /> <Item Text="DataMatrix" Value="DataMatrix" /> <Item Text="AztecCode" Value="AztecCode" /> <Item Text="QRCode" Value="QRCode" /> </mobile:SelectionList> <mobile:Command ID="Command1" Runat="server" OnClick="Command1_Click">Barcode Now</mobile:Command></mobile:Form> </body> </html>
5.為按鈕編碼。在按鈕事件過程中,生成一個固定 URL 條碼,這個條碼在Barcode Professional 中叫做"Codeless Barcode Generation",能自動檢測移動設備的首選圖像。
VB
Protected Sub Command1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Command1.Click 'Use Codeless barcode generation... ' - Please refer to web.config under HttpHanlder node for BarcodeGen settings ' - Please refer to "Codeless Barcode Generation" topic of product help for further details about params. Dim barcodeSymbology As String = Me.SelectionList1.Selection.Value Me.Image1.ImageUrl = "~/BarcodeGen.axd?S=" + barcodeSymbology + "&C=" + Server.HtmlEncode(Me.TextBox1.Text) + "&BH=0.2&MS=0.04" Me.Image1.Visible = True End Sub
C#
protected void Command1_Click(object sender, EventArgs e) { //Use Codeless barcode generation... // - Please refer to web.config under HttpHanlder node for BarcodeGen settings // - Please refer to "Codeless Barcode Generation" topic of product help for further details about params. string barcodeSymbology = this.SelectionList1.Selection.Value; this.Image1.ImageUrl = "~/BarcodeGen.axd?S=" + barcodeSymbology + "&C=" + Server.HtmlEncode(this.TextBox1.Text) + "&BH=0.2&MS=0.04"; this.Image1.Visible = true; }
完成!創建項目,進行測試。
本文譯自
購買最新正版授權!""
慧都年終盛典火爆開啟,一年僅一次的最強促銷,破冰鉅惠不容錯過!!優惠詳情點擊查看>>
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn