如何使用存储过程没有一个ObjectDataSource来填充一个DropDownList [英] How to populate a dropdownlist using a stored procedure without an objectdatasource

查看:99
本文介绍了如何使用存储过程没有一个ObjectDataSource来填充一个DropDownList的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的工作,需要不同的用户信息将被显示的网页。几个不同的用户将使用这个页面,所以数据会为每个帐户不同。我是新来的编程维护网页,使裸露的我。

I am working on a webpage that requires distinct user information to be displayed. several different users will be using this page, so the data will be different for each account. I am new to programming maintenance pages so bare with me.

此信息是通过存储过程通过entitymodel检索。

this information is retrieved through stored procedures via entitymodel.

由于我对DDL SP需要一个参数(用户ID),我不能用一个ObjectDataSource(除非有办法做到这一点,在我不知道!)的用户标识在页面加载通过ASPNET成员抓起。该DDL也需要在页面开辟了填充。
 我做了一些研究编程填充DDL,但找不到任何的例子是裁缝什么,我试图做的。

I cannot use an objectdatasource because my SP for the DDL requires an parameter(UserId) (unless there is a way to do it, in which I would not know !) The UserId is grabbed at page load via aspnet membership. this DDL also needs to be populated as the page opens up. I have done some research on programmatically populating a DDL but cannot find any examples that tailor to what I am trying to do.

我通过用参数(用户ID),当页面打开了一个SP需要一个普通的DDL被填充(项目和值)。
仅此而已,无外乎:)

I need a general DDL to be populated(item and value) by a SP with a parameter(userId), when the page opens up. Nothing more, nothing less :)

我的问题基本上是;这将是填充在这种情况下DropDownList的最好的办法

My question basically would be; what would be the best way to populate the dropdownlist under these circumstances

推荐答案

这后使用非类型化的DataSet和存储过程绑定到的CheckBoxList其原理是一样的(警告:自己的​​博客文章):

This post uses a Non-Typed-DataSet and a stored procedure to bind to a CheckBoxList which is the same principle (caveat: own blog post):

HTTP:// WWW 。codersbarn.com /后/ 2008/10/12 /绑定-的CheckBoxList到DataSet.aspx

这篇关于如何使用存储过程没有一个ObjectDataSource来填充一个DropDownList的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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