简体   繁体   English

自定义ASP.NET容器控制表单

[英]Custom ASP.NET Container Control Form

im fresh grad :D hehe. 我是应届毕业生:D呵呵。 i want to make a container controller, when user choose the dropdownlist the container will be loaded, or the page will be loaded Example : dropdownlist item : Category_form1, Category_form 2, Category_form 3 我想做一个容器控制器,当用户选择下拉列表时,将加载容器,或者将加载页面。示例:dropdownlist项目:Category_form1,Category_form 2,Category_form 3

<asp:DropDownList ID="ddlCategorySearch" runat="server" OnSelectedIndexChanged="ddlCategorySearch_SelectedIndexChanged" AutoPostBack="true"></asp:DropDownList>

and if the user choose Category_form2 Container will load Category_form2 如果用户选择Category_form2,则容器将加载Category_form2

.its hard to find a decent example of how to do this with ASP.NET. .its很难找到一个如何使用ASP.NET做到这一点的好例子。

Note : - the dropdownlist category is not only 3 form, but actually i have 20++ more different form 注意:-dropdownlist类别不仅是3种形式,但实际上我有20种以上的其他形式

Instead use the MultiView control. 而是使用MultiView控件。 It allows you to show one container at a time by setting the ActiveViewIndex=1 or SetActiveView(view1) 通过设置ActiveViewIndex=1 or SetActiveView(view1) ,您可以一次显示一个容器

From the toolbox, add a MultiViewControl, inside the multiview markup, from the toolbox again add as many View control as you wish. 从工具箱中,在多视图标记内添加一个MultiViewControl,再从工具箱中添加所需的尽可能多的View控件。 You can access each view with the index from 0,1,2.... and so on. 您可以使用索引从0,1,2 ....等访问每个视图。 Add contents to the views just like normal div. 就像普通div一样,将内容添加到视图中。 When the user makes a selection then you can do something like 当用户进行选择时,您可以执行以下操作

MultiView1.ActiveViewIndex = cboList.SelectedIndex

Oh... Remember to set the ActiveViewIndex = 0 property of the MultiView1 control, it will be the default view when the page loads. 哦...请记住要设置MultiView1控件的ActiveViewIndex = 0属性,它将是页面加载时的默认视图。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM