Knowing Checkbox value inside a Multiview/View/Datalist

Asked

Viewed 26 times

0

I wonder how the value of a checkbox which in turn is inside a DataList which is inserted within a View and the latter within a MultiView.

I tried some methods FindControl but without success.

  • Like you tried when you did for Findcontrol?

  • @Maicon Carraro CheckBox cb = FindControl("ckBoxStock") as CheckBox;
LinkButton lb = FindControl("linkBtnAddCart") as LinkButton;

if (cb.Checked != true)
{

 lb.Enabled = false;

}

  • This way I tested but without success. foreach (DataListItem item in DataListProdutosGridView.Items)
 {
 CheckBox ckBoxStock = (CheckBox)item.FindControl("ckBoxStock");
 LinkButton linkBtnAddCart = (LinkButton)item.FindControl("linkBtnAddCart");
 if (ckBoxStock.Checked)
 {
 linkBtnAddCart.Enabled = true;
 }

 else

 {
 linkBtnAddCart.Enabled = false;
 }
 }

  • Can someone help me?

  • Try putting var cb = SuaMultiView.FindControl("ckBoxStock") as CheckBox;

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.