Data Binding DDL to alternate table

Results 1 to 4 of 4

Thread: Data Binding DDL to alternate table

  1. #1
    Join Date
    Dec 1969

    Default Data Binding DDL to alternate table

    Folks,<BR><BR>I have a DG and in one of my columns in Edit mode I wish to bind a DDL to a table other then the DG source. Put it returns "System.Data.DataRowView" as an option value in the DDL.<BR><BR>If there&#039;s an example on the Internet, lemme know, cuz I just can&#039;t find one. Arghhhh!<BR><BR><BR><BR>My code for the DDL:<BR><BR>DataSet dsTrainer()<BR>{<BR><BR>String strConn, strCmd;<BR>strConn = @"Provider=Microsoft.Jet.OLEDB.4.0; data source=" +<BR>Server.MapPath("/training/database/TrainingUnit.mdb");<BR>strCmd = "SELECT LastName FROM TrainerDetails";<BR><BR><BR>OleDbDataAdapter DA = new OleDbDataAdapter(strCmd, strConn);<BR>DataSet DS = new DataSet();<BR>DA.Fill(DS, "Table");<BR><BR>return DS;<BR>}<BR><BR>-------------------------------------<BR>In the grid:<BR><BR>&#060;asp:dropdownlist ID="ddlTrainer" DataSource="&#060;%# dsTrainer() %&#062;"<BR>Runat="Server" /&#062;<BR><BR>-------------------------------------<BR>HTML result:<BR>&#060;option value="System.Data.DataRowView"&#062;<BR><BR><BR>T hx,<BR><BR>kim

  2. #2

    Default RE: Data Binding DDL to alternate table

    Try specifying the fields to use...<BR>DataTextField,DataVaueField

  3. #3
    Join Date
    Dec 1969

    Default How?

    I know what you mean, but I still can get it to work, so how?!?!<BR><BR>Thanks for your help!

  4. #4

    Default RE: How?

    I usualy do it in the ItemDatabound Event, not in the html.<BR><BR>&#060; asp:dropdownlist ID="ddlTrainer" <BR>DataValueField="valueFieldName"<BR>DataTextFie ld="textFiedName"<BR>DataSource="&#060;%# dsTrainer() %&#062;" <BR>Runat="Server" /&#062;

Posting Permissions

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