ListItem is an ambiguous reference between System.Web.UI.WebControls.ListItem and iTextSharp.text.ListItem

Last Reply on Feb 12, 2015 06:32 AM By Azim

Posted on Feb 12, 2015 06:31 AM

i used itextsharp dll to genrate pdf but when i added its reference to project it gives an ambiguity error like

" 'ListItem' is an ambiguous reference between 'System.Web.UI.WebControls.ListItem' and 'iTextSharp.text.ListItem'"   

using System.IO;
using iTextSharp.text;
using iTextSharp.text.html.simpleparser;
using iTextSharp.text.pdf;

namespace library15.Librarian.LibrarianWebPages
    public partial class BindingBookRecord : System.Web.UI.Page
        IDataReader dr;
        DataTable dt;
        BusinessAcessLayer.BookBindingRecord blayer = new BusinessAcessLayer.BookBindingRecord();
        protected void Page_Load(object sender, EventArgs e)
        void AddMonthandYearInDll()
            ddlMonth.Items.Add(new iTextSharp.text.ListItem("---Select---", "0"));            
            ddlMonth.Items.Add(new ListItem("Jan","1"));
            ddlMonth.Items.Add(new ListItem("Feb", "2"));
            ddlMonth.Items.Add(new ListItem("Mar", "3"));
            ddlMonth.Items.Add(new ListItem("Apr", "4"));
            ddlMonth.Items.Add(new ListItem("May", "5"));
plz help me ass possible


Posted on Feb 12, 2015 06:32 AM

You need to write this way to add ListItem in DropDownList.

ddlMonth.Items.Add(new System.Web.UI.WebControls.ListItem("---Select---", "0"));