473,397 Members | 1,974 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,397 software developers and data experts.

easy question

Hi,

I have this easy piece of code:

public class Box1:System.web.ui.webcontrols.webcontrol
{
protected Button mybutton;
protected override void OnInit()
{
InitializeComponent();
}
private void InitializeComponent()
{
this.Controls.add(mybutton);
}
}
public class Gereral_Control:System.web.ui.webcontrols.webcontr ol
{
protected Box1 mybox1=new Box1();
protected override void OnInit(EventArgs e)
{
InitializeComponent();
}
private void InitializeComponent()
{
this.Controls.add(mybox1)
}
}

Take in count this piece of code, how could i make that: when i press the button (the button inside the webcontrol Box1) appears some textboxes and another button?(something like a form)

Thanks in advance.
Wong chian.
Nov 15 '05 #1
4 1295
Hi,

I think it would be better to do that in client-side JavaScript code,
provided there are no browser limitations preventing you from using
JavaScript and DHTML. You should re-post your question in the
microsoft.public.dotnet.framework.aspnet newsgroup otherwise.

Briefly, you should expose an event from the Box1 control which is raised
when the button is pressed (you will most likely raise it from a
Button_Click handler). Then, the parent control handles the exposed event
upon postback and adds necessary controls to its Controls collection in the
event handler.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"Wong chian" <an*******@discussions.microsoft.com> wrote in message
news:41**********************************@microsof t.com...
Hi,

I have this easy piece of code:

public class Box1:System.web.ui.webcontrols.webcontrol
{
protected Button mybutton;
protected override void OnInit()
{
InitializeComponent();
}
private void InitializeComponent()
{
this.Controls.add(mybutton);
}
}
public class Gereral_Control:System.web.ui.webcontrols.webcontr ol
{
protected Box1 mybox1=new Box1();
protected override void OnInit(EventArgs e)
{
InitializeComponent();
}
private void InitializeComponent()
{
this.Controls.add(mybox1)
}
}

Take in count this piece of code, how could i make that: when i press the button (the button inside the webcontrol Box1) appears some textboxes and
another button?(something like a form)
Thanks in advance.
Wong chian.


Nov 15 '05 #2
Hi Dmitriy.
First of all, thanks for your answer...

I have some difficulties to make this in javascript, due that the form that i want to generate, is dinamic, exactly my problem its that when a user select a Initial Catalog in my application, there are a web custom control that shows the tables, and when the user select the table if after that click in a button (the text of the button is insert), the application generate the neccesary textboxes, to insert a new record in that initial catalog, and in that table chosen...

Could you give me an advice, sometimes for me its very difficult the comunication between the webcustom controls...
thanks
josema
Nov 15 '05 #3
What is your problem in communication between Web controls? In most cases,
events work just fine.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"josema" <an*******@discussions.microsoft.com> wrote in message
news:D2**********************************@microsof t.com...
Hi Dmitriy.
First of all, thanks for your answer...

I have some difficulties to make this in javascript, due that the form that i want to generate, is dinamic, exactly my problem its that when a user
select a Initial Catalog in my application, there are a web custom control
that shows the tables, and when the user select the table if after that
click in a button (the text of the button is insert), the application
generate the neccesary textboxes, to insert a new record in that initial
catalog, and in that table chosen...
Could you give me an advice, sometimes for me its very difficult the comunication between the webcustom controls... thanks
josema


Nov 15 '05 #4
Webcontrol1
________________________
| |
|initialize component |
| button +=new event..... |
| controls.add(button) |
| |
|event onclick |
| -control.add(webcontrol2) |
----------------------------------

webcontrol2
_____________________________
| |
| InitializeComponent |
| button2 +=new EventHandler...|
| -controls.add(textbox) |
| -controls.add(button2) |
| Onlclick |
| Response.write("hello") |
-----------------------------------------

The problem its that the webcontrol2 when you cick the button2 and the textbox dissapear from the webcontrol1 and dont show the word "hello"
Nov 15 '05 #5

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

Similar topics

1
by: rdsteph | last post by:
I am having a lot of fun using the pyGoogle module ( http://pygoogle.sourceforge.net/ ) that uses the Google API. It is about as easy to use as I can imagine, and it is a lot nicer than using my...
5
by: LedZep | last post by:
What up, All I need to do is enter a last name in a text box, query a MSAccess database and display the name with the corresponding columns. This is no problem, but when there are more than one...
13
by: Ghislain Tanguay | last post by:
I have a compiled vb.net app and I want to give the user a choice to launch it from the start line command and pass it a parameter or not. How can I do that in my code? Is it possible? Ex. :...
1
by: melanieab | last post by:
Hi, If there's a textbox and the text entered is longer than what's visible (the textbox length), how do you make it so that the beginning chunk of text is visible (instead of the last part of...
6
by: Martin Bootsma | last post by:
I have a C question, which looks very easy, but no one here seems to know an easy answer. I have a function "powell" (from Numerical Recipes) which takes an argument of the type "double...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...

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.