2
Je cache/affiche les panneaux de façon conditionnelle dans un DétailsView ... Je veux également masquer/afficher la ligne/le champ DetailsView que contient le panneau car il affiche actuellement des lignes vides lorsque les panneaux sont cachés?ASP DetailsView, masquer conditionnellement afficher les contrôles et la rangée?
ASCX:
<asp:DetailsView>
<asp:TemplateField>
<ItemTemplate>
<asp:panel runat="server" ID="pnlHideShow" OnInit="OnInit_Panel">
...
CodeBehind:
protected void OnInit_Panel(object sender, EventArgs e)
{
Panel pnl = (Panel) sender;
pnl.Visible = false;
switch (pnl.ID)
{
default:
break;
case "pnlHideShow":
pnl.Visible = (some condition);
//How to hide/show DetailsView item containing this panel?
break;
...
}
...
}
espoir Je ne suis pas un candidat pour "worse-than-failure";)
((TextBox) DetailsView1.FindControl (» txtComments ")). Parent.Parent.Visible a fonctionné pour moi :) – JumpingJezza