Which is a better code to avoid throwing Object reference not set to an instance of an object when using Telerik Radtextbox? Are both codes below the same? Can I set a default value to avoid nullreference from throwing?
protected void btnAddSAles_click(object sender, EventArgs e)
{
string orderName = Ordername.Text;
}
or
protected void btnAddSAles_click(object sender, EventArgs e)
{
TextBox b = item.FindControl("Ordername") as TextBox;
string box1 = b.text;
}