ASP.NET中的数据绑定 [英] Data bind in ASP.NET

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

问题描述

I have to get the Values ( A,B,C,D) from a table Named as dbo.Names from SQL Server.I had done it manually ,but how to i achieve the same using select statement from table..???or a variable having the value from stored procedure??

                <div class="col-sm-4 lhs-form-box" style="padding: 10px; height: 247px;">
                    <div class="form-group" style="width: 87%; float: left;">
                        <label for="sel1">ITEM</label>
                        <asp:DropDownList ID="ddl_QU" runat="server" class="form-control">
                            <asp:ListItem Text="A" Value="A"></asp:ListItem>
                            <asp:ListItem Text="B" Value="B"></asp:ListItem>
                            <asp:ListItem Text="C" Value="C></asp:ListItem>
                            <asp:ListItem Text="D" Value="D"></asp:ListItem>
                        </asp:DropDownList>
                    </div>
                    <span>
                        <img src="info.png" style="margin: 31px 0px 0px 5px"></span>

                </div>





< b>我尝试了什么:



我手动完成。

如何使用select语句实现相同的效果DB。



What I have tried:

I have done it manually.
How do i achieve same using select statement from DB.

推荐答案

参考这篇文章并开始

使用C#从ASP.Net中的sql server绑定/填充/填充DropDownList控件 [< a href =https://www.aspsnippets.com/Articles/Bind-Fill-Popula te-DropDownList-control-from-database-in-ASPNet-using-C-and-VBNet.aspxtarget =_ blanktitle =New Window> ^ ]
refer this article and start
Bind / Fill / Populate DropDownList control from sql server in ASP.Net using C#[^]


请参考以下链接,您将了解如何从数据库中逐步填充它。



c# - 从数据库填充DropDownList的正确方法是什么? - 堆栈溢出 [ ^ ]
Please refer below link you will get idea how you need to populate it from database progrmatically.

c# - What is the right way to populate a DropDownList from a database? - Stack Overflow[^]


这篇关于ASP.NET中的数据绑定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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