469,631 Members | 1,328 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,631 developers. It's quick & easy.

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 1197
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by LedZep | last post: by
13 posts views Thread by Ghislain Tanguay | last post: by
1 post views Thread by melanieab | last post: by
6 posts views Thread by Martin Bootsma | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.