473,396 Members | 2,002 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Web Forms

As i asked u earlier also that is it possible to create a
web form dynamicaly and add controls to it?

For example i will write the HTML code and script code in
a single file by name Default.aspx and execute it will it
work. And when ever i want to add controls i will write
the code into same file including the events script also
will it execute it correctly.

And later if i add this .aspx page to a WEB APPLICATION
will it run correctly? Please give me the information at
the earliest

<%@Page language="vb" inherits="CodeBehindClass"
src="Default.vb" %>
<form runat="server">
<asp:button id="button1" text="button 1"
onclick="button1_click" runat="server" />
<asp:label id="lbl" text="label and button in the aspx
file " runat="server" />
</form>

<script language="C#" runat="server">
void button1_click (Object sender, EventArgs e)
{
Response.Write("hello world");
}
</script>
Nov 17 '05 #1
3 1213
1.- Create controls at runtime? Yes, of course you can:
Button myButton = new Button();
myButton.text = "the text in the button"
myButton.Click += System.EventHander(this.myCustomHandler);
Page.Controls.Add(myButton);

Just be aware that might be considerations when dealing
with runtime created controls values in a PostBack.

2.- Create webforms at runtime?... Uhmm,i guess no but it
doesn't make sense to me. If you can post a case when that
would be necessary...

Esteban
-----Original Message-----
As i asked u earlier also that is it possible to create a
web form dynamicaly and add controls to it?

For example i will write the HTML code and script code in
a single file by name Default.aspx and execute it will it
work. And when ever i want to add controls i will write
the code into same file including the events script also
will it execute it correctly.

And later if i add this .aspx page to a WEB APPLICATION
will it run correctly? Please give me the information at
the earliest

<%@Page language="vb" inherits="CodeBehindClass"
src="Default.vb" %>
<form runat="server">
<asp:button id="button1" text="button 1"
onclick="button1_click" runat="server" />
<asp:label id="lbl" text="label and button in the aspx
file " runat="server" />
</form>

<script language="C#" runat="server">
void button1_click (Object sender, EventArgs e)
{
Response.Write("hello world");
}
</script>
.

Nov 17 '05 #2
No, that won't work. An html file is not an aspx file. You need more than
just an aspx extention on a file for it to be an asp.net application. What
exactly are you trying to accomplish? Maybe there is a work around.

--
-----------
Got TidBits?
Get it here: www.networkip.net/tidbits
"Vannela" <an*******@discussions.microsoft.com> wrote in message
news:03****************************@phx.gbl...
As i asked u earlier also that is it possible to create a
web form dynamicaly and add controls to it?

For example i will write the HTML code and script code in
a single file by name Default.aspx and execute it will it
work. And when ever i want to add controls i will write
the code into same file including the events script also
will it execute it correctly.

And later if i add this .aspx page to a WEB APPLICATION
will it run correctly? Please give me the information at
the earliest

<%@Page language="vb" inherits="CodeBehindClass"
src="Default.vb" %>
<form runat="server">
<asp:button id="button1" text="button 1"
onclick="button1_click" runat="server" />
<asp:label id="lbl" text="label and button in the aspx
file " runat="server" />
</form>

<script language="C#" runat="server">
void button1_click (Object sender, EventArgs e)
{
Response.Write("hello world");
}
</script>

Nov 17 '05 #3
Ya this will work nicely!

"Vannela" <an*******@discussions.microsoft.com> wrote in message
news:03****************************@phx.gbl...
As i asked u earlier also that is it possible to create a
web form dynamicaly and add controls to it?

For example i will write the HTML code and script code in
a single file by name Default.aspx and execute it will it
work. And when ever i want to add controls i will write
the code into same file including the events script also
will it execute it correctly.

And later if i add this .aspx page to a WEB APPLICATION
will it run correctly? Please give me the information at
the earliest

<%@Page language="vb" inherits="CodeBehindClass"
src="Default.vb" %>
<form runat="server">
<asp:button id="button1" text="button 1"
onclick="button1_click" runat="server" />
<asp:label id="lbl" text="label and button in the aspx
file " runat="server" />
</form>

<script language="C#" runat="server">
void button1_click (Object sender, EventArgs e)
{
Response.Write("hello world");
}
</script>

Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

19
by: James Fortune | last post by:
I have a lot of respect for David Fenton and Allen Browne, but I don't understand why people who know how to write code to completely replace a front end do not write something that will automate...
3
by: Joshua Russell | last post by:
Hi, Both the methods below open up a windows form called MasterForm. However, one works better than the other. Method 1 opens the form correctly but I don't have any reference to the instance of...
7
by: Mike Bulava | last post by:
I have created a base form that I plan to use throughout my application let call the form form1. I have Built the project then add another form that inherits from form1, I add a few panel controls...
13
by: MD | last post by:
I have been converting a program from VB6 to VB.Net and enhancing it as well. All has been progressing OK although its been hard work. Now, all of a sudden, when I try to execute a ShowDialog()...
15
by: Joshua Kendall | last post by:
I have a script in which it keeps opening the same form instead of only one instance. I also need help with a form that has a password. Where do I put the actual password? can I use a database for...
3
by: Lloyd Sheen | last post by:
I have the following situation: Need a user resizable user control. After much trying with user control I came across the idea of hosting the controls in a form marked as not TopLevel = false. ...
8
by: Stephen Rice | last post by:
Hi, I have a periodic problem which I am having a real time trying to sort. Background: An MDI VB app with a DB on SQL 2000. I have wrapped all the DB access into an object which spawns a...
3
by: Geraldine Hobley | last post by:
Hello, In my project I am inheriting several forms. However when I inherit from a form and add additional subroutines and methods to my inherited form I get all sorts of problems. e.g. I sometimes...
6
by: dbuchanan | last post by:
I have a Windows Forms application that accesses SQL Server 2k from a small local network. The application has been used for weeks on other systmes but a new install on a new machine retruns...
21
by: Dan Tallent | last post by:
In my application I have a form (Customer) that I want to be able to open multiple copies at once. Within this form I have other forms that can be opened. Example: ZipCode. When the user enters...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.