Select Categories Below
Advertisement
Start Your Own Q&A Site
Create your own Q&A site easily, allowing you to quickly grow a new community around any subject matter or generate new organic traffic for your existing website.
Status: Open Points: 75 Time: 03:58 - May 31, 2007
manohar.patil
Question faced during development, so please reply fast.
Categories:
Add Categories
When adding more than one category, separate them with commas.
PeterNZ
Date:: May 31, 2007
Time:: 17:29
I hope that's fast enough!!! ;-) First, let me tell you, that what you want to do is not good design. You tie the user control to the parent and are dependent that there is a method or property on the parent! This creates dependencies which should be avoided. It would be the same as if a Button control is using a property on the form. You would only be able to add Button controls to forms which have this property! Anyway, here is a solution: I have a form which has a textbox named Textbox1. I create a Web User Control, which has a button and a label. If you click the button, the web user control gets the text of textbox1 from the parent control and sets the label's text to this text. The code is: protected void Button1_Click(object sender, EventArgs e) { TextBox tb = (TextBox) this.Parent.FindControl("TextBox1"); if(tb != null) { Label1.Text = tb.Text; } else { Label1.Text = "TextBox1 doesn't exist in parent container!" } } This only lets you access a public property on the parent form!!! The way you should do this (and a good design!) is, you should add an event to your web user control and handle the event on the parent form. Lets say you want to update an address after a user entered his/her address details in your web user control. The method which updates the database is on the parent form. You fire an event i.e. AddressUpdated Event from the web user form and handle this event on the parent page. The eventhandler initiates the update on the database. If you need to read a return value from this update, you should put it in a public property of the parent page and read this property in the web user control. Does this make sense? Cheers Peter
admin
Date:: Aug 22, 2007
Time:: 20:22
manohar.patil, did you get your question solved? If you did then please close this question and distribute the points. If you found the solution on your own, we would be very happy if you could explain it here for the sake other users having the same problem. If you didn't get a solution to your problem, please leave a comment here to let the experts know that you're still looking for an answer. Thanks, The Quomon Admin Team
Date:: Mar 04, 2009
Time:: 11:44
The question looks to be abandoned by the user who asked it. If no action is taken within 2 days, a Quomon Moderator will consider closing the question and distributing the points. The Quomon Team
huddiestbeast
Date:: Nov 12, 2009
Time:: 00:57
declare the method in the form aspx.cs file as public ,then inherit the class to the ascx.cs form and then call the method
Answer this Question
New User
Email:
Upon submission of this form, you will automatically be registered as a Quomon user and we will send your login information to this address
Registered User
Username:
Password:
Forgot Your Password?
Enter your email address below and we will resend your login information to you.
Login Information Sent
Questions
whats the best food to eat during midnight?
How to identify the tiffany jewelry? www.tffanycheapmall.com.
Send an email alert to each user of the php application based on criteria
How I Increased My AdSense Earnings?
how to choose the lady dress ?
How can I fulfill the minimum requirement to make your computer support 3D?
You have 100 characters to use
Rank
Expert
Points
1.
10354
2.
6493
3.
5596
4.
4848
5.
3487
6.
2840
7.
2770
8.
2303
9.
1820
10.
917
Register today to share your knowledge with the community and be recognized and rewarded for your contributions.
Register Here
"Psst, Quomon is a great site. Pass it on." Tell a Friend | Link To Us | Save to Delicious | Digg it
Language Options
English:
Español:
Sponsors
Questions and Answers Software