ASP.NET设计时间问题 [英] ASP.NET Design Time Issues

查看:56
本文介绍了ASP.NET设计时间问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的,我有一个我编写的自定义服务器组件继承了Composite Control和INamingContainer(不相关,但我想设置阶段)。我在ASPX中测试了组件并且一切正常。


现在,我决定要在我的组件周围包含一些额外的功能 - 没有足够的通用性可以将它放入服务器控件本身但在我的应用程序中足够通用,我想把它放到用户控件中。


所以,我将我的组件定义的aspx代码复制并粘贴到我的ASCX并保存该设计。该组件以设计模式显示,并且在设计时看起来像我期望的那样。它出现在designer.vb文件中,我没有错误。 <%@ Register%>指令正确显示。


现在,当我为ASCX转到CodeBehind时,我尝试按照通常的方式引用组件 - 通过ID; FuelGrid1.Member =等等等等,它给了我一个波浪形的蓝色下划线并告诉我该物体不存在。


有谁知道会导致这种情况的原因是什么?我认为它最初是因为我在调试期间将对象粘贴到ASCX中并且它最初没有重写designer.vb - 所以通常只是为我的对象剪切ASCX def,保存,粘贴它并重新保存它 - 这次它没有,这让我想知道,我的服务器组件有什么东西可以让它用作用户控件的一部分,我不会这样做,以允许它用作我页面的一部分?或者这是一些我无法找到有关某人有解决方法的文档吗?

Okay, I''ve got a custom server component that I wrote that inherits Composite Control and INamingContainer (irrelevant, but I want to set the stage). I tested the component in an ASPX and all is working fine.

Now, I decided I want to wrap some extra functionality around my component - nothing generic enough to put it into the server control itself but generic enough within my application that I want to put it into a user control.

So, I copy and paste the aspx code for the definition of my component to my ASCX and save the design. The component shows up in design mode and looks as I would expect it to at design time. It appears in the designer.vb file and I have no errors. The <%@ Register %> directive appears correctly.

Now, when I go to the CodeBehind for my ASCX and I try and reference the component as I normally would - by the ID; FuelGrid1.Member = blah blah blah, it gives me the little squiggly blue underline and tells me that the object doesn''t exist.

Does anyone know what would cause this? I thought it was initially caused because I pasted the object into the ASCX during a debug and it didn''t initially rewrite the designer.vb - so normally just cutting the ASCX def for my object, saving, pasting it back and resaving it works - this time it hasn''t, which leads me to wonder, is there something that I have to do with my Server Component that allows it to be used as part of a user control that I wouldn''t do to allow it to be used as part of my page? Or is this some bug I can''t find any documentation on that someone has a workaround for?

推荐答案

好的,如果你愿意的话,叫我白痴... (弓)


由于某些奇怪的原因我的<%@ Control%>指令是继承错误的命名空间。
Okay, call me an idiot if you like... (bow)

For some odd reason my <%@ Control %> directive was inheriting the wrong namespace.


你有错误和正确的<%@%> line?
Do you have the wrong and right <%@ %> lines?


@Plater


我有权利<%@%>行 - 它指向正确的代码隐藏文件...然而它指向一个不正确的命名空间。


我在一段时间后改变了项目的命名空间,但出于某种原因,我创建了新的ASCX它坚持旧的 - 不知道为什么还没有,我修复了症状,所以我现在可以继续。
@Plater
I had the right <%@ %> lines - it was pointing at the right codebehind file...it was however pointing at an incorrect namespace.

I changed the namespace on the project a while back, but for some reason when I created the new ASCX it persisted the old one - not sure why that is yet, I fixed the symptom though, so I can get on for now.


这篇关于ASP.NET设计时间问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆