.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Post New Web Links

Is it possible to populate property choices from a database?

Posted By:      Posted Date: August 21, 2010    Points: 0   Category :ASP.Net

I'm creating my first server control, and have it working where I can set up an enum and the user can set a property's choices,  based off of that enum.  But I'd like it to pull records from a database and populate the list of choices for the property from a database.  This would allow me to add a new "Host System" to the database, and the other designers wouldn't have to get a new copy of the dll.



View Complete Post

More Related Resource Links

Getting "wrong" data out of a microsoft.sqlserver.management.smo.database object property (using pow

My problem:I do something like this:$dbsvr = new-object microsoft.sqlserver.management.smo.server "servername"$dbsvr.databases | ft name,size -autosizeWhen i run this from two different PC's i get database sizes that are all the same (5.25 mb), the size of the first database listed - which is master.I started to try out a few things, and found out that when i run the same command from one of our servers it returns the correct sizes...Anyone have any idea if this a SMO issue, or maybe some package software version issue...- or what?

Write select query with a paremetrized where clause, and populate database with the retrieved column

I want to be able to retrieve column values using the dropdownlist values as parameters then populate the tbPO table with the retreived values. Where and how do I do it. ImportsSystem.Data.OleDb ImportsSystem ImportsSystem.IO Imports ?directcostDataSetTableAdapters PartialClass po_header  Inherits System.Web.UI.Page  Dim cn As OleDbConnection  Dim cmd As OleDbCommand  Dim dr As OleDbDataReader  Dim icount As Integer  Dim str As String  Dim vendor_id As Object   ?  Public Sub btn_click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button1.ClickTry   context.Items.Add(     cmd.CommandType = System.Data.   cmd.CommandText = Dim context As HttpContext = HttpContext.Current"Company_Name", DropDownList3.Text)Dim cn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\Users\Owner\Documents\Visual Studio 2010\WebSites\WebSiteJun25\App_Data\directcost.mdb;")Dim cmd As New OleDbCommand()CommandType.Text"insert into tbPO(ponumber, suppliername, ShipTo, basictype, DateNeeded, Purpose,ShippingInstr, ProjId) values(?,?,?,?,?,?,?,?)" cmd.Parameters.AddWithValue( cmd.Parameters.AddWithValue( cmd.Parameters.AddWithValue( cmd.Parameters.AddWithValue( cmd.Parameters.AddWithValue( cmd.Parameters.AddWithValue( cmd.Parameters.AddWithValue( cmd.Parameters.Add

Populate RadiobuttonList from Database



I am using:

 If IsDBNull(ds.Tables("tblStateDocuments").Rows(0).Item("IsPublic")) Then


 DropDownList3.SelectedValue = varDocPublic

 Dim varDocPublic As String = (ds.Tables("tblStateDocuments").Rows(0).Item("IsPublic"))

dropdown list wont populate values from database


Hello everyone i need help. Ive been having this problem for almost  3 days now. dropdown list won't populate from database

Below is the code i am using:

<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="PhotoAlbum.aspx.vb" Inherits="PhotoAlbum" %>

<asp:SqlDataSource ID="categoriesDataSource" runat="server"  
<%$ ConnectionStrings:ConnectionString %>"  
    SelectCommand="SELECT [CategoryID], [Name] FROM [Categories] WHERE ([UserId] = @UserId) ORDER BY [Name]"> 
<asp:QueryStringParameter Name="UserId" QueryStringField="ID"/> 

load new page and populate the values without database



I'm creating a website of 5 pages using c# (asp.net).

How do i link 2 pages, ie., on click of a button on first page should take me to second page.

Advance thanks,


How to manually populate a listview control without a database connection?


Hi to all,

I'm currently developing an ASP.net application w/ VB as the code behind. I have a page that shows all the user name currently assigned to the system. The problem now is that the page does not communicate directly to the database. Instead, I use HTTPrequest to get all the user names from a different sever. Now I want to populate the listview control w/ the response that I got (and not directly from the database).

How should I do it? Please help.



Populate entity data model from database


I've been using entity data models for quite a few sections of my website and find it really good for saving things to the database.

After searching for a while, I can't seem to find a good way to populate a new instance with data from a database other than using a data reader. E.G:

MyClass.myID = reader("myID")

Am I missing something?

populate pdf form fields from database or XML


 Hi, I have a web app that stores data in an SQL database. What I want to be able to do is to have a pdf form with fields that I can later populate with the database info. I can either go directly from the database or I can perform an intermediate conversion to XML if that will work better. Can anyone point me towards a tutorial or a step by step explanation of how to get started? I'm pretty much a noob in the pdf world.


Mark B

Populate asp:RadioButtonList with values from database


Hi All!

I have a gridview with a RadioButtonList I need to populate. It is as such"

<asp:GridView ID="GridView1" AllowPaging="true" PageSize="7" runat="server" DataSourceID="mainDS"

DataKeyNames="id" AutoGenerateColumns="False" Width="100%" RowStyle-BackColor="LightGray"

AutoGenerateEditButton="false" AutoGenerateSelectButton="false" AlternatingRowStyle-BackColor="white"

HeaderStyle-BackColor="Black" HeaderStyle-ForeColor="white" ForeColor="black"

PagerStyle-ForeColor="#1A7A5E" EmptyDataText="No Data To Display">


<asp:BoundField HeaderText="Question" DataField="number" ItemStyle-Wrap="false" ItemStyle-VerticalAlign="Top" />

<asp:BoundField DataField="question" ItemStyle-Wrap="false" ItemStyle-VerticalAlign="Top" />

<asp:TemplateField HeaderText="Select">


<asp:Label ID="Qid" Text='<%# Eval("number") %>' runat="server" Visible="false" />

<asp:RadioButtonList ID="answer" runat="server"

ManagedProperty requires access to SharePoint database to set FullTextQueryable property


I have the following method below to set the FullTextQueryable property on a ManagedProperty

  public class Search
    /// <summary>
    /// Set a managed property to be both queriable and retrievable.
    /// </summary>
    /// <param name="managedProperty">The name of the property</param>
    /// <param name="makeFullTextQueriable"></param>
    public static void SetManagedPropertyFullTextQueriable(string managedProperty, bool makeFullTextQueriable)


      SearchService searchService = SearchService.Service;

      SearchServiceApplication searchApp = searchService.SearchApplications.GetValue<SearchServiceApplication>(

How do you set the LocalConnectionString Max Database Size property on the RDA object in C++?


How do you set the LocalConnectionString Max Database Size property on the RDA object in C++?

We have an C++ application running under PPC 2003. The SQL Server Compact edition 3.5 service pack 2 is installed.

We have successfully created a local database using the DBPROP_SSCE_MAX_DATABASE_SIZE property and set the size to 386mb.

The local database can be written locally to up to the Max Database Size.

When we perform a Pull operation with the RDA object the Pull fails when we set the Max Database Size property on the RDA LocalConectionString.

When we perform a Pull operation with the RDA object the Pull succeeds when we set only the Data Source property. But we can only Pull up to 128mb (the default size).



Multiple database support with Entity Framework

One of the features introduced in Entity Framework is being database independent. Which mean each database provider can support Entity Framework by implementing its provider.

This feature allows you build applications independent from the underplaying database provider. In this post I'm going to show how to build an application that support multiple databases using same conceptual model made by Entity Framework.

Export Visio Database Table Names to Excel

If you use the Enterprise Architect edition of Microsoft Visio for data modeling regularly, then there is a good chance that at some point you've wanted to export just the table names into Excel. You might want to do this to map logical ERD entities to physical data model tables, track project status by entity, or track overlap between database versions.

MS SQL Server: Disconnect Users From Database - Kill User Session

If you ever wanted to restore your database from a SQL backup file (.bak), but there are still users connected to your database, the backup operation will fail causing the error: Exclusive access could not be obtained because the database is in use.

Publishing SQL Server Database using Publishing Wizard : Tips & Tricks

We can use SQL Server Publishing Wizard to deploy our local Database to remote hosting server/production server.This feature is available in SQL Server 2008/VWD 2008.

Below is the complete step by step guide of this process.

Adding Rows in GridView without using a Database

This article describes on how to add rows in GridView without using a database. Basically the GridView will be populated with data based on the values entered in the TextBox on Button Click and retain the GridView data on post back.

Adding Multiple Columns and Rows in GridView without using a Database

This article describes on how to add multiple columns and rows in GridView without using a database. Basically the GridView will be populated with data based on the values entered in each TextBoxes on Button Click and retain the GridView data on post back.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend