By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,670 Members | 1,558 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,670 IT Pros & Developers. It's quick & easy.

Dynamically Populate A Label

P: n/a
I am trying to populate a label on a web form

Let’s say I have the following select statement

“Select Wonum, Location, Priority, Equipment from Workorder

I have the following labels on the WebForm

wonumLabel, locationLabel, priorityLabel, equipmentLabe

How do I populate the labels

wonumLabel.Text =

locationLabel.Text =

priorityLabel.Text =

equipmentLabel.Text =
Nov 15 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
You need to explain further. What format is your data source in when it
reaches the web page?

If it is a DataView...

wonumLabel.Text = theDataView[nRow].Row["theFieldName"]
"Dave Bailey" <an*******@discussions.microsoft.com> wrote in message
news:78**********************************@microsof t.com...
I am trying to populate a label on a web form.

Let's say I have the following select statement:

"Select Wonum, Location, Priority, Equipment from Workorder"

I have the following labels on the WebForm:

wonumLabel, locationLabel, priorityLabel, equipmentLabel

How do I populate the labels?

wonumLabel.Text = ?

locationLabel.Text = ?

priorityLabel.Text = ?

equipmentLabel.Text = ?

Nov 15 '05 #2

P: n/a
As I said before ...
DataView objDV = CreateDataSource()
wonumLabel.Text = objDV[0].Row["Wonum"] // "0" is the first row in the
dataview

"Dave Bailey" <an*******@discussions.microsoft.com> wrote in message
news:D5**********************************@microsof t.com...
The DataView is created like this:

public DataView CreateDataSource()
{
string woConnect = "Connection String";
string woSelect = "Select Wonum, Location, Priority, Equipment where Wonum = 123456"; oda = new oleDbDataAdapter(woSelect, woConnect);
DataSet ds = new DataSet();
oda.Fill(ds, "wo");
DataView wo = ds.Tables{"wo"].DefaultView;
return wo;
}

How do I move from here to populating the labels?

Thanks,

Dave

Nov 15 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.