access one web user control datalist Template Item to some othere web user and check validation
I have a web user control suppose a.ascx there is a datalist template item linkbtn lnktbnA
i am adding the data in that and binding it.
I have a web user control suppose b.ascx there is a btn BB
now i want to check IF there is any开发者_StackOverflow中文版 item named as Final Page then page redirect to some other page else it show some msg that final page is not available you can't go to next page
I want to check this validation on btn click bb which is in web user control b.ascx
On the button click of 2nd user control you can validate control of 1st user control. Check code below.
UserControl user1 = (UserControl)this.NamingContainer.FindControl("[Object usercontrol]");
DataList dl = (DataList)user1.FindControl("[Object datalist]");
LinkButton lbtn = (LinkButton)dl.FindControl("[Object LinkButton]");
// Check the validation
if(lbtn != null)
{
// Do stuff
}
else
{
// Do other stuff
}
You want to check "item named as Final Page" from a.ascx and want to validate on button click of b.aszx. Please advice.
精彩评论