c# - In some of my my user controls, the sub elements are not created at page load -


I know that I should understand this, but I can not work it, I have a page with many user controls on it - I have created a set of user controls to handle the data on the page, because it helps to split some user controls well, though others are failing.

The error is that subcontrols are not created - that is they are set to zero in the page-load but they should have been created at this point, I thought - and the controls that work There are also sub-rules that start working. And these names do not have a typo because they compile pages, and I have not messed about the names.

Do anyone have any ideas or suggestions about why this can happen? I do not think the posting code will help, because the code is not something special, but if someone wants to see me in any way I know.

This is C #, Donnet, web site Thank you!

ETA Some Code:

  & lt; Tr & gt; & Lt; Cass: comment id = "comment" runat = "server" title = "comments" /> & Lt; / TR & gt;   

This is html as follows: Comment control is working in other places.

  comment.Value = value.Comment;   

When I try it in Page_Load - After EnsureChildControls, I get the message:

The object is not set to an instance of the reference object - the other Not with notifications

When I search, it is a comment object that is set to clear.

I should say that it is on other controls, so this comment is not controlled - this is what happens to me to make amendments to enceocceral control

Depending on your whole design, in some cases you should ensure that sub / child controls have been made, for example in many cases The quality of your overall server control is delivered in this way Are:

  public string Text {get {EnsureChildControls (); return label. Text; } Set {EnsureChildControls (); the label. Text = value; }}   

For full explanation, see here: As I said, it depends on the actual case and the sections you are using, but in fact your code without knowing Impossible to do / P>

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -