扩展程序提供程序控制问题 [英] Extender provider control question

查看:63
本文介绍了扩展程序提供程序控制问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我已经进行了扩展的提供程序控制.到目前为止,一切都很好.就像我想要的那样.

在提供者的属性中,我可以选择国家"和食物".

表单中的每个控件都会获得一个新的属性属性:选择子项".

这个想法是,当我在提供程序中选择国家/地区"时,我应该从选择子项"(表单控件的属性)的下拉列表中选择国家/地区.
当我在提供程序中选择食物"时,控件下拉菜单中的项目应为食物类型(苹果,面包,您自己命名).

用简单的英语来说,我的应用程序应该做什么:

1.将自己制作的提供程序添加到表单中.
2.在表单中添加一个按钮
3.在提供者的属性中,选择国家/地区"
4.打开按钮的属性.搜索属性选择子".在这里选择一个国家.
5.再次打开提供程序的属性.选择食物"
6.在按钮的属性中,搜索选择子项".在这里选择一种食物类型.

注意:这一切都在设计时完成!

现在我的问题是:
如何根据提供程序中选择的值更改控件中下拉菜单的值?

希望我的问题很清楚,希望有人能帮助我.

在此先感谢.

Hi,

I have made an extended provider control. So far, so good. It works like I want to.

In the properties of the provider I can select "Country" and "Food".

Each control in the form gets a new property attribute: "Select sub".

The idea is that when I have selected "Country" in the provider, I should select countries from the dropdown in "select sub" (property of a control on form).
When I select "Food" in the provider, the items in the dropdown of the control should be types of food (Apple, Bread, you name it).

This is in plain English what my application should do:

1. Add the own made provider to the form.
2. Add a button to the form
3. At the properties of the provider, select "Country"
4. Open the properties of the button. Search for the property "Select sub". Select a country here.
5. Open the properties of the provider again. Select "Food"
6. In the properties of the button, search for "Select sub". Select a food-type here.

NOTE: This is all in design-time!

And now my question:
How can I change the value of the dropdown in the control according to the value selected in the provider?

Hope my question is clear and that someone can help me.

Thanks in advance.

推荐答案

我认为这是不可能的.我知道为提供的属性指定项目列表的唯一方法是使用枚举.但是无法告诉控件根据特定选择使用不同类型的枚举.

不久前,我写了一篇有关ExtenderProvider的文章,该文章是我创建的,用于向文本框添加拼写检查功能.我确实有自定义的下拉列表,这些列表是动态填充的,但是它们是在实际属性上,而不是在提供的属性上. (在我的代码中,请参见Property Language)

我看不到有任何方法可以做到.实际上,我什至会质疑您为什么要这样做.提供的属性并不能很好地控制它们的显示方式或包含的内容.

但是,如果您对我所做的事情感到好奇,则可以获取我的源代码,并且对如何进行动态设计时选择进行了简要说明. ( NHunspellTextBoxExtender [
就像我说的那样,问题是要向设计人员提供选项列表,您必须创建一个枚举,然后将该属性类型设置为该枚举.但是,您不能动态地将类型更改为其他枚举,这就是为什么AFAIK无法执行您想做的事情.
I don''t think it''s possible. The only way I know of to specify a list of items for a provided property is to use an enum. But there''s no way to tell the control to use a different type of enum based on a certain selection.

I wrote an article a while back about an ExtenderProvider that I created to add spell-checking to textboxes. I did have custom drop-down lists that were populated dynamically, but they were on actual properties, not provided properties. (in my code, see Property Language )

I don''t see any way that you can do that. In fact, I would even question why you would want to do that. Provided properties do not give you a lot of control of how they are shown or what they can contain.

But, if you''re curious about what I did, you can get my source code and there''s a brief explanation on how to do dynamic design-time selection. (NHunspellTextBoxExtender[^])

[Fixed the link...seems to keep removing the x from aspx]

The only suggestion that I would have would be to have two provided properties. One for Country and one for food.

When the user selects Country in the property for the extender, then it uses the selection in the Country provided property and ignores anything that was selected in the Food provided property.

The issue, like I said, is that to provide a list of options to the designer, you would have to create an enum and then set that property type as that enum. But, you can''t change the type to a different enum dynamically, which is why, AFAIK, you can''t do what you''re wanting to do.


这篇关于扩展程序提供程序控制问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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