E
Eric W. Holzapfel
Hello Group,
As far as a dropdownlist, is there a way to access both values for
the datatextfield (like a name, etc) AND the value of the datavaluefield
(like a record number, or index etc).
the dropdown list is populated by a query to a datbase table.
loaded with a datareader like below:
Dlist.DataSource = myCommand.ExecuteReader();
Dlist.DataTextField = TextField; (this would be a name, "Jones Inc.")
Dlist.DataValueField = ValueField; ("CustID", the value of which
is a number like 101, etc)
Dlist.DataBind();
I am using c#, and a dropdown component. It show the name just fine,
but I have not yet seen how to get the customer id associated with the
name (the number is a primary key). I can do it by concatenating two
values from the table like "14 Jones Inc." and then dividing the string
at the space char. I would like to have the dropdown show the only
name, and be able to access the customer id as well.
I have not yet seen how (or if) this can be done with a webcontrol and
web form in .net.
Any tips would be helpful,
Thanks,
eric
As far as a dropdownlist, is there a way to access both values for
the datatextfield (like a name, etc) AND the value of the datavaluefield
(like a record number, or index etc).
the dropdown list is populated by a query to a datbase table.
loaded with a datareader like below:
Dlist.DataSource = myCommand.ExecuteReader();
Dlist.DataTextField = TextField; (this would be a name, "Jones Inc.")
Dlist.DataValueField = ValueField; ("CustID", the value of which
is a number like 101, etc)
Dlist.DataBind();
I am using c#, and a dropdown component. It show the name just fine,
but I have not yet seen how to get the customer id associated with the
name (the number is a primary key). I can do it by concatenating two
values from the table like "14 Jones Inc." and then dividing the string
at the space char. I would like to have the dropdown show the only
name, and be able to access the customer id as well.
I have not yet seen how (or if) this can be done with a webcontrol and
web form in .net.
Any tips would be helpful,
Thanks,
eric