Object reference not set to an instance of an object.
fromPageRange = Functions.ToInt32(((Label)grdFiles.Rows[i].FindControl("lblFromPageRange")).Text);
grdFiles.Rows[i].FindControl("lblFromPageRange"))
Label aLabel = (Label)grdFiles.Rows[i].FindControl("lblFromPageRange")) if (null != aLabel && null != aLabel.Text) { Int32 value = Convert.ToInt32(aLabel.Text); }
public int ParseText(int positionInArray, string whichLabelToFind) { Label aLabel = positionInArray <= grdFiles.Rows.Count ? (Label)grdFiles.Rows[positionInArray].FindControl(whichLabelToFind) : null; int result = default(int); return aLabel != null ? Int32.TryParse(aLabel.Text, out result) ? result : result : result; }
bool isValid = int32.TryParse( (Label)grdFiles.Rows[i].FindControl("lblFromPageRange")), out fromPageRange );
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)