如何使用动态控制使用Sql数据填充Asp网站 [英] How Do I Make A Asp Website With Dynamic Controles Who Fill Themselves With Sql Data

查看:78
本文介绍了如何使用动态控制使用Sql数据填充Asp网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我想知道如何制作一个ASP网站,其中标签,图像和文本框是动态的,并且不断添加多个行的控制器在SQL数据库中有。



因此,如果我在sql数据库中添加一行并打开Web应用程序,该行将自动显示它。



我知道如何让控制动态,但我不知道如何添加SQL连接。



我希望我能够解释自己,并希望你们能帮助我。



非常感谢,


Robert

Hi,

I was wondering how i could make a ASP website where the label, image and textbox is made dynamic and keeps adding controles as much as many rows there are in the SQL database.

So if i add a row in the sql database and i open the web application that row would automatically show it self.

I know how to make controles dynamic but i don't know how to add teh SQL connection to it.

I hope i explained my self enough and hope that you guys can help me.

Many thanks,

Robert

推荐答案

您需要遍历代码中返回的每一行,并为要与其关联的每个数据动态创建控件。然后将这些控件写到页面上。



您可以添加数据以显示如下内容:



textbox.text = data_item_from_db.value;



然后,也许是PlaceHolder和:



占位符。 controls.add(文本框);



这非常简单,但应该让你弄明白。
You would need to loop over each row returned in code and create controls dynamically for each piece of data that you want to associate with them. Then write those controls out to the page.

You would add the data to display something like:

textbox.text = data_item_from_db.value;

Then, perhaps a PlaceHolder and:

placeholder.controls.add(textbox);

That's very simplistic but should enable you to figure it out.


这篇关于如何使用动态控制使用Sql数据填充Asp网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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