dynamic loaing of the controls on the dynamically created page

  • Thread starter abhishek dave via .NET 247
  • Start date
A

abhishek dave via .NET 247

(Type your message here)

--------------------------------
From: abhishek dave
hi,
I have a problem regarding dynamically loading of the web page.
As I also want to dynamically load the controls onto the page(which is being dynamically created) inheriting the page
for eg

'this is a class to create a dynamic control
public class txtplus:inherits textbox1

end class

'this class loads the page dynamically
public class pageGenerate:inherits page

dim txtplus1 as txtplus
Public Sub New()
Me.ID = "frm1"
title = New Label()
With title
.ID = "form1"
.Text = "page generate"
.ForeColor = Color.Red
.BackColor = Color.Yellow

End With

txtplus1 = new txtplus()
me.findcontrol("frm1").controls.add(txtplus1)
End Sub
end class

the above class is inherited int the pageGenerate.aspx as
<%@ page inherits = "pageGeneate.aspx"%>

when the aboe code executes it generates an error
'txtplus1' of type 'txtplus' should be placed inside the form tag with
runat = server

please kindly help me to solve this problem
 
V

Victor Garcia Aprea [MVP]

Apparently you're adding the txtplus control to the page controls'
collection itself and not to the form control controls' collection.

--
Victor Garcia Aprea
Microsoft MVP | ASP.NET
Looking for insights on ASP.NET? Read my blog:
http://obies.com/vga/blog.aspx



abhishek dave via .NET 247 said:
(Type your message here)

--------------------------------
From: abhishek dave
hi,
I have a problem regarding dynamically loading of the web page.
As I also want to dynamically load the controls onto the page(which is
being dynamically created) inheriting the page
 
V

Victor Garcia Aprea [MVP]

Apparently you're adding the txtplus control to the page controls'
collection itself and not to the form control controls' collection.

--
Victor Garcia Aprea
Microsoft MVP | ASP.NET
Looking for insights on ASP.NET? Read my blog:
http://obies.com/vga/blog.aspx



abhishek dave via .NET 247 said:
(Type your message here)

--------------------------------
From: abhishek dave
hi,
I have a problem regarding dynamically loading of the web page.
As I also want to dynamically load the controls onto the page(which is
being dynamically created) inheriting the page
 
V

Victor Garcia Aprea [MVP]

Apparently you're adding the txtplus control to the page controls'
collection itself and not to the form control controls' collection.

--
Victor Garcia Aprea
Microsoft MVP | ASP.NET
Looking for insights on ASP.NET? Read my blog:
http://obies.com/vga/blog.aspx



abhishek dave via .NET 247 said:
(Type your message here)

--------------------------------
From: abhishek dave
hi,
I have a problem regarding dynamically loading of the web page.
As I also want to dynamically load the controls onto the page(which is
being dynamically created) inheriting the page
 

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

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top