Click here to Skip to main content
15,888,610 members
Please Sign up or sign in to vote.
1.44/5 (2 votes)
See more:
I have one child with textboxes and parent form with insert button.when we click on insert button in parent form the data in textboxes of child has to inserted into sqlserver database.
Posted

1 solution

This is not how it works. In particular, it's important to understand that in .NET you cannot invoke an event from anywhere except the class or structure where the event instance is defined. You cannot do it even in a derived class. In all other cases, you don't invoke events but handle them by adding a handler to the invocation list of some event instance. You need to read about events on .NET as right now you seemingly don't really have a clue. Not to worry, it will come.

However, in your case you don't have to use events. Instead, you can write a Web form with the "POST" method. Its submit button will cause the browser to send appropriate HTTP request without any code except HTML (but on server side, you will need to write the code processing the request and, say, storing data in your database). Please learn how to do it, for example, from this MSDN article:
http://msdn.microsoft.com/en-us/magazine/cc163736.aspx[^].

—SA
 
Share this answer
 
Comments
laxmi smiley 8-May-13 2:44am    
if i use post problem in have multiple child forms in future.by using delegates how can we do?
Sergey Alexandrovich Kryukov 8-May-13 9:34am    
Not clear. First of all, there is no such thing as "child form". (Note that having many forms is a bad design, but this is a different problem.) What's the problem. Why "by using delegates"? (Yes, this one of the ways used for from collaboration, but why? just because you have read about this way? When you ask a question on some functionality, it's better not to include answer in the question.)
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900