Control panel visibility inside datagrid

Discussion in 'ASP .Net' started by =?Utf-8?B?TWFubnkgQ2hvaGFu?=, Apr 9, 2005.

  1. 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
    =?Utf-8?B?TWFubnkgQ2hvaGFu?=, Apr 9, 2005
    #1
    1. Advertising

  2. 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

    "Manny Chohan" <> wrote in message
    news:...
    > 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
    >
    Eliyahu Goldin, Apr 10, 2005
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. HS1
    Replies:
    3
    Views:
    470
  2. HS1
    Replies:
    4
    Views:
    8,275
    Babu Kalakrishnan
    Dec 8, 2004
  3. =?Utf-8?B?TWFubnkgQ2hvaGFu?=

    Control panel visibility

    =?Utf-8?B?TWFubnkgQ2hvaGFu?=, Sep 15, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    356
    Cowboy \(Gregory A. Beamer\)
    Sep 15, 2006
  4. Ulf Meinhardt
    Replies:
    0
    Views:
    595
    Ulf Meinhardt
    Jul 7, 2009
  5. James

    datagrid on a panel that has visibility set to false

    James, Oct 5, 2003, in forum: ASP .Net Datagrid Control
    Replies:
    5
    Views:
    139
    Jacob Yang [MSFT]
    Nov 22, 2003
Loading...

Share This Page