P
Paxtonend
I want to concatenate the values from two columns in the datatextfield of a
drop down list, so that it displays a series of job titles followed by the
count of job titles in brackets, e.g. Job Title 1 (17), Job Title 2 (22)
etc. This is pretty simple to do in classic ASP, but doing it in C# has got
me stumped. I can get one or other value to display, but can't find a way
to get both. Can anyone help? Here's the code from the ascx.cs file
(excluding connection string):
myDataAdapter = new OleDbDataAdapter("SELECT Jobtitle.JobTitle,
Count(Jobtitle.JobTitle) AS CountOfJobTitle, Adverts.JobTitleID FROM Adverts
INNER JOIN Jobtitle ON Adverts.JobTitleID = Jobtitle.JobTitleID WHERE
StartDate <= Date() AND EndDate >= Date() GROUP BY Jobtitle.JobTitle,
Adverts.JobTitleID ORDER BY Jobtitle.JobTitle;", myOleDbConnection);
mydataset = new DataSet();
myDataAdapter.Fill(mydataset);
DropDownList1.DataSource =ds.Tables [0] ;
DropDownList1.DataTextField = //What goes here?
DropDownList1.DataValueField
=ds.Tables[0].Columns["JobTitleId"].ColumnName.ToString();
DropDownList1.DataBind();
drop down list, so that it displays a series of job titles followed by the
count of job titles in brackets, e.g. Job Title 1 (17), Job Title 2 (22)
etc. This is pretty simple to do in classic ASP, but doing it in C# has got
me stumped. I can get one or other value to display, but can't find a way
to get both. Can anyone help? Here's the code from the ascx.cs file
(excluding connection string):
myDataAdapter = new OleDbDataAdapter("SELECT Jobtitle.JobTitle,
Count(Jobtitle.JobTitle) AS CountOfJobTitle, Adverts.JobTitleID FROM Adverts
INNER JOIN Jobtitle ON Adverts.JobTitleID = Jobtitle.JobTitleID WHERE
StartDate <= Date() AND EndDate >= Date() GROUP BY Jobtitle.JobTitle,
Adverts.JobTitleID ORDER BY Jobtitle.JobTitle;", myOleDbConnection);
mydataset = new DataSet();
myDataAdapter.Fill(mydataset);
DropDownList1.DataSource =ds.Tables [0] ;
DropDownList1.DataTextField = //What goes here?
DropDownList1.DataValueField
=ds.Tables[0].Columns["JobTitleId"].ColumnName.ToString();
DropDownList1.DataBind();