I seem to always have problems with this. I have a button outside of the View that calls a function that needs an OrderNumber. I keep getting an error,
There is no TextBox control in your details view, you should use a TemplateField, like this:
Then you can use the FindControl() method to get the Label control by ID value, like this:
Label theOrderNumberLabel = Order_DetailsView.FindControl("LabelOrderNumber") as Label;
// Verify that we found the label before we try to use it
if(theOrderNumberLabel != null)
{
string orderNumberText = theOrderNumberLabel.Text;
// Do something with order number here
}