ASP.net C#中的web.config [英] web.config in ASP.net C#

查看:70
本文介绍了ASP.net C#中的web.config的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在页面中有2个下拉菜单.我希望两个下拉列表都应通过从web.config进行绑定来填充.根据我的理解,我们可以在web.config的Appsettings中添加Element.但是它们每个都会被索引.因此,在填充时,我必须从应用程序设置的第5个元素中说出第5个元素开始第二个下拉列表.有什么办法可以创建两个不同的应用程序设置元素并填充列表????

I have 2 drop down in a page. I want both Drop downs should be populated by binding from web.config. According to my understanding we can add Element in Appsettings in web.config. But each of them will be indexed. So while populating i have to start the seconddropdown from half of the element say 5th in app settings. Is there any way i can create two different app setting elements And populate the list????

推荐答案

您的webconfig中的连接字符串是什么?是的,您可以在应用程序配置中存储所需的任何值,并根据需要命名它们.但是,应该是处理该抽象的数据层,而表示层应该只是在显示数据.
What is in your webconfig, the connection string ? Yes, you can store any values you want in your app config, and name them whatever you require. However, it should be your data layer that deals with this abstraction and your presentation layer should just be showing the data.


您还可以创建Xml文件并使用xml文件填充这些下拉列表.希望这将是最好的过程.大多数情况下,我们将web.config文件用于不适合存储数据的应用程序设置.

希望对您有帮助.

谢谢

问候

Lalit Kumar
印度
You can also create Xml Files and populate these dropdownlist using xml files. hope it will be best process. mostly we uses web.config file for application setting not for suitable to store data.

hope it will help you.

Thanks

Regards

Lalit Kumar
India


这篇关于ASP.net C#中的web.config的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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