Getting contents of a PlaceHolder

  • Thread starter Thread starter IndyChris
  • Start date Start date
I

IndyChris

I am attempting to add a drill down datagrid to my webpage so the user
will not have to leave the page to get further information on a row.

There are 12 other columns before this column.
<asp:TemplateColumn>
<ItemStyle Width="1" />
<ItemTemplate>
<asp:PlaceHolder ID="ExpandedContent" Visible="false" Runat="server">
</td></tr>
<tr>
<new datagrid goes here>

</td> </tr> </asp:PlaceHolder> </ItemTemplate> </asp:TemplateColumn>

Here's what I'm trying to do in the C# code. This should trigger when
the user clicks the +/- sign at the beginning of the row.
protected void Grid_ItemCommand( Object sender, CommandEventArgs e )
{
if ( e.CommandName == "Expand" )
{
ExpandedContent =
(PlaceHolder)this.ConfGrid.Columns[this.ConfGrid.Columns.Count - 1].
// PlaceHolder ExpandedContent =
(PlaceHolder)confGrid.Item.Cells[confGrid.Columns.Count -
1].FindControl("ExpandedContent");
ExpandedContent.Visible = !(ExpandedContent.Visible);
// ImageButton btnExpand =
(ImageButton)ConfGrid.Item.Cells[0].FindControl("btnExpand");
if (btnExpand.ImageUrl == "~/Images/Plus.gif")
{
btnExpand.ImageUrl = "~/Images/Minus.gif";
}
else
{
btnExpand.ImageUrl = "~/Images/Plus.gif";
}
}

I can't get the ExpandedContent to have a value. How to I get the
contents of the PlaceHolder into my variable.

Thanks
 
Nevermind...I figured it out. I wasn't properly using the event
handler. All is good now.
 
Back
Top