jesper

jesper

  • NA
  • 89
  • 54.1k

cant convert papersource to list

Jan 11 2013 6:12 AM
Hi im trying to convert winform to asp.net, i have one fail i cant see how to solve:

  1. PaperSource pkSource;
  2. List<object> listPaperSource = new List<object>();
  3. protected void comboFillPapersource()
  4. {
  5. for (int i = 0; i < printDoc.PrinterSettings.PaperSources.Count; i++)
  6. {
  7. if (printDoc.PrinterSettings.PaperSources[i].SourceName == "test")
  8. {
  9. pkSource = printDoc.PrinterSettings.PaperSources[i];
  10. }
  11. listPaperSource.Add(printDoc.PrinterSettings.PaperSources[i]);
  12. }
  13. DropDownPaperSource.DataSource = listPaperSource;
  14. DropDownPaperSource.DataTextField = "SourceName";
  15. DropDownPaperSource.DataValueField = "RawKind";
  16. DropDownPaperSource.SelectedItem = pkSource;
  17. DropDownPaperSource.DataBind();
  18. }
the code prints papersources from a defined printer. its the second last line that fail, with, cant convert papersource to itemlist (DropDownPaperSource.SelectedItem = pkSource; 

With the error cant convert papersourse to listitem



 :/

Answers (1)