Click here to Skip to main content
16,008,175 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hi,

i have 2 user control in a aspx page .in 1st user control i have a gridview. on selecting items from gridview the selected thing will appear on a label which is on 2nd user control.


thanks in advance
Posted
Comments
Sergey Alexandrovich Kryukov 6-Aug-11 23:54pm    
So..?
--SA

Use delegates to tie events between controls.
 
Share this answer
 
My suggest is:
Solution 1: create 1 static variable in user control 2

Solution 2:
In aspx page, add 1st user control, 2st control will be add dynamically in code behind

Create an property in 2st user control, such as;
public string LabelInControl2 { get; set;}

At 1st user control, gridview selecting item event, you will add 2st user control depend on which item is selected, code example:

// create dynamic user control
string path= "your_2st_user_control_url.ascx";
UserControl2 uc2 = (UserControl2)Page.LoadControl(path);

// set control property
uc2.LabelInControl2 = gridviewitem

// load control in main aspx
this.Page.Controls.Add(uc2)
 
Share this answer
 

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