I have 2 user control.main user control have a submit button and displaying another usercontrol with 2 textbox. ,after entry data in textbox , while click on submit button in main user control, i want textbox value and fileld name ..please provide a sample code...
Thanks..
Vincent Maverick DuranoPosted May 6, 2015, 7:19 AM
Anway I think you could make use of properties to access the values from user control just like in example #2
priyaranjan pandaPosted May 6, 2015, 12:12 AM
Thanks for your reply, but i am using windows application.these solution not working.
please give me some other solution.
Regards,
priyaranjan
Vincent Maverick DuranoPosted May 5, 2015, 9:43 AM
TextBox tb1 = (TextBox)YourUserControlID.FindControl("TextBox1");
TextBox tb2 = (TextBox)YourUserControlID.FindControl("TextBox2");
string value1 = tb1.Text;
string value2 = tb.Text;
Another way is to define some properties in your UserControl that would store the values from your TextBox like:
then at Button click even you can grab the values like this: