I feel your pain, as I am experiencing a similiar problem.  But here 
is an article that I've found quite useful:
http://aspnet.4guysfromrolla.com/articles/092904-1.aspx

Basically, you'll need to add your controls in the Page_Init then 
you should have access to them in the Page_Load.

Good luck.

--- In [email protected], Matías Niño ListMail 
<[EMAIL PROTECTED]> wrote:
>
> Hi y'all, 
> 
>  
> 
> I have created custom objects that represent different tables in a 
database. These objects all adhere to my interface for adding new 
records into each object's table through a web form by dynamically 
creating form controls and saving them on postback.
> 
>  
> 
> My objective is to have each object responsible for providing 
its 'new record' form controls and saving them upon postback. 
> 
>  
> 
> So, In order to insert a record into the database from a web form, 
I instantiate one of these objects and call it's GetNewFormPanel 
function, which returns a panel web control containing the proper 
controls for each field of the new record. This panel is then 
inserted into a placeholder on the web form. Upon Clicking the 
submit button, this panel is then fed back into the object and the 
object inserts a new record.
> 
>  
> 
> My problem is that when I submit the postback, the placeholder no 
longer appears to have the panel container as a child control! I 
need that panel container so that I can feed it back to the object 
so that the object can insert its new record. The error that I get 
is that placeholder findcontrol method returns a null object. I also 
interrogated the placeholder control with HasControls and it 
returned FALSE.
> 
>  
> 
> Any help or guidance on a better way to do this?
> 
>  
> 
> Here's a summary of the code: 
> 
>  
> 
> <script runat='server'>
> 
> Sub Page_Load(...)
> 
>             Dim MyObject as New WhateverType
> 
>             Dim pnlNewObect as Panel
> 
> pnlNewObect  = MyObject.GetNewFormPanel()
> 
> pnlNewObject.ID = "pnlNewForm"
> 
> NewFormPlaceHolder.Controls.Add(pnlNewObect)
> 
> End Sub
> 
>  
> 
> Sub Submit_Click(...)
> 
>             Dim myobject as New WhateverType
> 
>             MyObject.SaveNewFormPanel
(NewFormPlaceHolder.FindControl("pnlNewForm"))
> 
> End Sub
> 
> </script>
> 
>  
> 
> <html>
> 
> <asp:placeholder runat='server' id='NewFormPlaceHolder'/>
> 
> <asp:Button runat='server' id='Submit' onclick='Submit_Click' 
text="Save New Record"/>
> 
> </html>
> 
> 
> 
> [Non-text portions of this message have been removed]
>






------------------------ Yahoo! Groups Sponsor --------------------~--> 
Get fast access to your favorite Yahoo! Groups. Make Yahoo! your home page
http://us.click.yahoo.com/dpRU5A/wUILAA/yQLSAA/saFolB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to