Obj Ref Not Set

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I am trying to feed retained values from an object i created into some
textbox's. I get a Object Ref not set error. Plz take a look at the code:

I have this in my main class global section:

protected BLL.HoursEntry _userInput = new BLL.HoursEntry();


The following is in the Edit Command for a Datagrid:

_userInput.MonReg = Convert.ToDouble(((Label)
e.Item.FindControl("lbMon")).Text);
_userInput.MonOT = Convert.ToDouble(((Label)
e.Item.FindControl("lbMonOT")).Text);

((TextBox)e.Item.FindControl("tbMon")).Text =
Convert.ToString(_userInput.MonReg);
((TextBox)e.Item.FindControl("tbMonOT")).Text =
Convert.ToString(_userInput.MonOT);

I assume since when page gets loaded that user input object would get
created as well. I get no errors on the first two lines when assigning values
to userinput.
Only when I try to read value from userinput to textbox does it bomb. What
am I missing?

Thanks,

JJ
 
ok I think I have a better understanding of problem. In my EditCommand for
datagrid the following code works:

<code>

_userInput.MonReg = Convert.ToDouble(((Label)
e.Item.FindControl("lbMon")).Text);

</code>

I can find the controls in item template during this stage. Now I need to
know in what event during EDIT Mode can I find the textbox controls that are
in my EditItemTemplate?

JJ
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top