473,831 Members | 2,250 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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()
{
InitializeCompo nent();
}
private void InitializeCompo nent()
{
this.Controls.a dd(mybutton);
}
}
public class Gereral_Control :System.web.ui. webcontrols.web control
{
protected Box1 mybox1=new Box1();
protected override void OnInit(EventArg s e)
{
InitializeCompo nent();
}
private void InitializeCompo nent()
{
this.Controls.a dd(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?(somethi ng like a form)

Thanks in advance.
Wong chian.
Nov 15 '05 #1
4 1313
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.publi c.dotnet.framew ork.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*******@disc ussions.microso ft.com> wrote in message
news:41******** *************** ***********@mic rosoft.com...
Hi,

I have this easy piece of code:

public class Box1:System.web .ui.webcontrols .webcontrol
{
protected Button mybutton;
protected override void OnInit()
{
InitializeCompo nent();
}
private void InitializeCompo nent()
{
this.Controls.a dd(mybutton);
}
}
public class Gereral_Control :System.web.ui. webcontrols.web control
{
protected Box1 mybox1=new Box1();
protected override void OnInit(EventArg s e)
{
InitializeCompo nent();
}
private void InitializeCompo nent()
{
this.Controls.a dd(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?(somethi ng 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*******@disc ussions.microso ft.com> wrote in message
news:D2******** *************** ***********@mic rosoft.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(bu tton) |
| |
|event onclick |
| -control.add(web control2) |
----------------------------------

webcontrol2
_______________ ______________
| |
| InitializeCompo nent |
| button2 +=new EventHandler... |
| -controls.add(te xtbox) |
| -controls.add(bu tton2) |
| 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
2238
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 old HTMl screen scraping habits. My online CGI program Ask Merlin at www.awaretek.com/askmerlin.html is an example. Currently, the program takes any user's question and picks the best answer from amongst the possible answers given by the user....
5
1535
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 records with the same last name, I need to click a command button to display the next record with that name. I cant find it in any of my books and it sounds like an easy enough question. Any help is definately appreciated. TIA,
13
1485
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. : MyApp.exe "Go"
1
1494
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 it)? Thanks again!!! Mel
6
2300
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 (*f)(float)" But I want to be able to pass a
0
9793
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9642
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10493
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10526
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9315
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6951
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5617
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4416
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3960
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.