Hi,
I am new to ASP.NET and have run into a slight snag. I am populating a
dropdownlist with data from a stored procedure to a datareader:
*************************************************************
Try
MyConnection.Open()
MyDataReader =3D
MyCommand.ExecuteReader(CommandBehavior.CloseConnection)
ListPayerProd.DataSource =3D MyDataReader
ListPayerProd.DataBind()
Catch myException As Exception
Response.Write("An error has occurred: " &
myException.ToString())
Finally
If Not MyDataReader is Nothing Then
MyDataReader.Close()
End If
ListPayerProd.Items.Insert(0, "Select a Product")
ListPayerProd.SelectedIndex =3D 0
End Try
End If
*************************************************************
The last couple of lines before "End Try" set the selected option of the
dropdownlist to "Select a Product." However, I need to set it so that
option value=3D"0">Select a Product</option> - right now it outputs
<option value=3D"Select a Product">Select a Product</option>. How can I
specify DataValueField and DataTextField here?
Any suggestions are very much appreciated!
Thank you,
John