开发者

how to avoid this error

In my page, if i refer using System.windows.forms; using System.web.webcontrols.....

Textbox ambiguos refernece error is开发者_运维技巧 occured from webcontrols and forms,

how can i rectify this error... but i need those two namespaces in my asp.net page.


Let me first say that I find it a bit odd that you need to reference System.Windows.Forms in an ASP.NET project.

As already posted by ondesertverge, you can fully qualify your types. You can create aliases for the namespaces to save some typing:

using WebForms = System.Web.WebControls;
using WinForms = System.Windows.Forms;

// ...

var textbox = new WebForms.TextBox();


You can fully qualify one of them.

System.Windows.Forms.TextBox


You can alias the namespaces and uses the alias for each type:

using winforms = System.Windows.Forms;
using webForms = System.Web.Webcontrols;
...

     winforms::TextBox ...
     webforms::TextBox ...

...

Another option is to use the full name for each type (including the namespace), to avoid ambiguity.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜