PDA

View Full Version : Ambigous matches



DasPhansom
Apr 24, 2009, 12:02 PM
Some of your Library Names in Code result in Ambigous matches. Like Listitem or else. This is not a big problem but its also pretty annoying.

Greetings

Das Phansom

jchau
Apr 24, 2009, 2:17 PM
Try not to import the namespace globally? I haven't ran into this yet.

geoffrey.mcgill
Apr 24, 2009, 7:38 PM
There are only a handful of Toolkit controls with the same name as standard asp.net webcontrol and I find I rarely have conflicts. If I do it's simple to prefix namespace one or the other. And, it's only an issue with the server-side code.

You can also alias the objects as the following sample demonstrates.

Example


using System;
using Coolite.Ext.Web;
using Button = Coolite.Ext.Web.Button;
using Panel = Coolite.Ext.Web.Panel;

namespace Coolite.Sandbox.Temp.Window
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Button button = new Button();
Panel panel = new Panel();

System.Web.UI.WebControls.Panel panel2 = new System.Web.UI.WebControls.Panel();
}
}
}

And, it's never a problem if you don't import the System.Web.UI.WebControls namespace. ;)

Hope this helps.