Skip to content

Instantly share code, notes, and snippets.

@arijusg
Created July 3, 2014 11:54
Show Gist options
  • Save arijusg/3049beba72ddf80ccbf4 to your computer and use it in GitHub Desktop.
Save arijusg/3049beba72ddf80ccbf4 to your computer and use it in GitHub Desktop.
Nested GridView
<asp:TemplateField HeaderText="More =>">
<ItemTemplate>
<asp:ImageButton ID="imgBtnExpand" runat="server" CommandName="Expand"
CommandArgument='<%# ((GridViewRow) Container).RowIndex %>' ImageUrl="~/images/expand_button.png" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
</td></tr>
<tr>
<td colspan="100%">
<asp:Panel ID="pnlJobList" runat="server" Visible="false" Style="position: relative; left: 25px;" ViewStateMode="Enabled">
asd;sdlfdjfgdsfhgldfhgldfsjhg
</asp:Panel>
</td>
</tr>
</ItemTemplate>
</asp:TemplateField>
protected void gvTotalStatistics_OnRowCommand(object sender, GridViewCommandEventArgs e)
{
if(e.CommandName != "Expand") return;
var imgBtn = (ImageButton)gvTotalStatistics.Rows[Convert.ToInt32(e.CommandArgument)].FindControl("imgBtnExpand");
var pnl = (Panel)gvTotalStatistics.Rows[Convert.ToInt32(e.CommandArgument)].FindControl("pnlJobList");
if (pnl.Visible)
{
pnl.Visible = false;
imgBtn.ImageUrl = "~/Images/expand_button.png";
}
else
{
pnl.Visible = true;
imgBtn.ImageUrl = "~/Images/expand_button_down.png";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment