0
Reply

setting label text to dataset element text

rhenson

rhenson

Oct 29 2004 8:35 AM
1.7k
Hi, I'm learning .net and C# and am having problems setting a label's text value to a data element value in a dataset for display as part of a webform. Any help would be greatly appreciated. Here is where I am: Given a function that returns a datset: public DataSet getDetail(string itemIDIn) { //I can do which this: DataSet ds = GetDataSet("SELECT * FROM myTable WHERE UniqueID = '" + itemIDIn + "'"); //or I can do this if needed, just not sure if it is DataSet ds = GetDataSet("SELECT myTable.Description AS Description, myTable.Color AS Color WHERE UniqueID = '" + itemIDIn + "'"); return ds; } On my webform.cs I have: protected System.Web.UI.WebControls.Label descLabel; protected System.Web.UI.WebControls.Label colorLabel; private void Page_Load(object sender, System.EventArgs e) { if (!IsPostBack) { ds1.Equals(db.getDetail("123"); //Now, how do I set the text to descLabel and colorLabel to the text in the dataset??? } } With this definition on the webform itself:   Description:     Color: