NEWBIE - How do I display a single field for a single record in a label

  • Thread starter Thread starter RockNRoll
  • Start date Start date
R

RockNRoll

Greetings,

I have a table in a database with two fields, "Contract Number" and
"Contract Name." "Contract Number" is the primary key.

I would like to display the Contract Name in a label when the user selects a
Contract number from a listbox.

I know how to bind a SQL query to a datagrid, but not how to display a
single field for a single record in a label.

Your help would be greatly appreciated.

Thanks,
-Dave
 
<ASP:LABEL id="Label1" runat="server">
<%# DataBinder.Eval (Container, "DataItem.ContactName") %>
</ASP:LABEL>

FYI: You may want to stop using space chars in your database table and field
names as they become a problem from the programming interface. I'm not sure
of how to indicate your field name above with a space in its name.
 
Back
Top