Control panel visibility inside datagrid

G

Guest

Hi,
i have a template column in datagrid. Inside template column i have panel. I
want to control the visibility of the panel with checkbox. can this be done?

<asp:TemplateColumn>
<ItemTemplate>
<asp:panel id="pnlDocumentDetailsGrid" runat="server"
Visible="False">
<TABLE id="Table112" cellSpacing="0" cellPadding="0"
width="100%" border="0">
<TR bgColor="#1d4076">
<TD width="1%"> </TD>
<TD align="left">
<FONT style="FONT-WEIGHT: bold; FONT-SIZE: 12pt;
FONT-FAMILY: Arial" color="#c3daff">
<%# Container.DataItem("description")%>
</FONT>
</TD>
<TD align="right">
<FONT style="FONT-WEIGHT: bold; FONT-SIZE: 12pt;
FONT-FAMILY: Arial" color="#c3daff">
Bulletin: <%# Container.DataItem("uploaddate")%>
</FONT>
</TD>
<TD>
<IMG src="../images/Curly.jpg"></TD>
</TR>
</TABLE>
</asp:panel>
</ItemTemplate>
</asp:TemplateColumn>

Here is my codebehind itemdatabound event:


Sub dGridAvailableDocuments_Bound(ByVal sender As Object, ByVal e As
DataGridItemEventArgs)
If cBoxDocDetails.Checked Then
e.Item.FindControl("pnlDocumentDetailsGrid").Visible = True
End If

End Sub

Thanks

Manny
 
E

Eliyahu Goldin

Manny,

It's a client-side task. In ItemDataBound event add "onclick" attribute to
the checkbox. It will be your client-side onclick event handler. In the
handler you will need to find the panel by it's id and control it's
visibility via style.display or style.visibility properties. You will want
to pass the panel ClientId from the server to the checkbox's onclick event
handler.

Eliyahu
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top