Combining fields in listbox...

Results 1 to 3 of 3

Thread: Combining fields in listbox...

  1. #1
    Join Date
    Dec 1969

    Default Combining fields in listbox...

    If I wanted say, name and firstname to be the DATATEXTFIELD, can i modify this, or should i do it in the query?<BR><BR>&#060;ASP:LISTBOX<BR> ID="lstRegions"<BR> VISIBLE="False"<BR> RUNAT="server"<BR> ROWS="1"<BR> DATAVALUEFIELD="id"<BR> DATATEXTFIELD="region"<BR>/&#062;<BR><BR>thanks all

  2. #2
    Join Date
    Dec 1969

    Default look @ this, and try it in sql

    here is the msdn documentation on the members of the listbox class:<BR> <BR><BR>from the looks of it, you need to combine name and lastname in your sql

  3. #3

    Default RE: Combining fields in listbox...

    I cant remember who first posted it, but this works. <BR>You may have to set the listbox properties in code.<BR>The new column allows concatenation, LangID and Lang are strings...<BR><BR>DataSet temp = <BR>SqlHelper.ExecuteDataset(ConnectionString,<BR> CommandType.StoredProcedure, <BR>"LanguageList");<BR>DataColumn myDC = new DataColumn("TESTCOL",String.Empty.GetType(),"Langu ageID + &#039; --- &#039; + LanguageName");<BR>temp.Tables[0].Columns.Add(myDC);<BR>LanguageDropDownList.DataSo urce = temp;<BR><BR>LanguageDropDownList.DataTextField = "TESTCOL";<BR>LanguageDropDownList.DataValueFi eld= "LanguageID";<BR>LanguageDropDownList.DataBind();< BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts