how to hide some cells of footer rowhttp://forums.asp.net/t/1800993.aspx/1?how+to+hide+some+cells+of+footer+rowFri, 11 May 2012 15:22:12 -040018009934969140http://forums.asp.net/p/1800993/4969140.aspx/1?how+to+hide+some+cells+of+footer+rowhow to hide some cells of footer row <p>i want to show some cells of footer row from code behind how to do??</p> 2012-05-07T12:56:46-04:004969551http://forums.asp.net/p/1800993/4969551.aspx/1?Re+how+to+hide+some+cells+of+footer+rowRe: how to hide some cells of footer row <p>Show your code please :) Sorry, crystal ball is in the shop. ;)</p> 2012-05-07T17:39:13-04:004969917http://forums.asp.net/p/1800993/4969917.aspx/1?Re+how+to+hide+some+cells+of+footer+rowRe: how to hide some cells of footer row <p>here is my design code</p> <pre class="prettyprint">&lt;asp:GridView ID=&quot;gvRequestDetail&quot; runat=&quot;server&quot; ShowFooter=&quot;true&quot; AutoGenerateColumns=&quot;False&quot; OnRowCommand=&quot;gvRequestDetail_RowCommand&quot; DataSourceID=&quot;RequestDetailsDS&quot;&gt; &lt;Columns&gt; &lt;asp:TemplateField HeaderText=&quot;Distribution List Name&quot;&gt; &lt;ControlStyle Width=&quot;15%&quot;&gt;&lt;/ControlStyle&gt; &lt;FooterTemplate&gt; &lt;asp:TextBox ID=&quot;txtlistname&quot; runat=&quot;server&quot; Enabled=&quot;false&quot; SkinID=&quot;InputTextbox&quot; Text=&quot;&quot;&gt;&lt;/asp:TextBox&gt; &lt;asp:Button ID=&quot;btn_dlist&quot; runat=&quot;server&quot; Text=&quot;...&quot; OnClientClick=&quot;return OpenRetDialogDistributionName('ctl00_ContentPlaceHolder1_gvRequestDetail_ctl03_txtlistname','ctl00_ContentPlaceHolder1_hfdlistid','ctl00_ContentPlaceHolder1_hfdlistname');&quot; CausesValidation=&quot;False&quot; Height=&quot;20px&quot;&gt;&lt;/asp:Button&gt; &lt;/FooterTemplate&gt; &lt;ItemTemplate&gt; &lt;asp:Label ID=&quot;lbl_distributionlist&quot; Width=&quot;30%&quot; runat=&quot;server&quot; Text='&lt;%# Bind(&quot;D_Name&quot;) %&gt;'&gt;&lt;/asp:Label&gt; &lt;/ItemTemplate&gt; &lt;/asp:TemplateField&gt; &lt;asp:TemplateField HeaderText=&quot;Approval&quot;&gt; &lt;AlternatingItemTemplate&gt; &lt;asp:LinkButton ID=&quot;lnkApprove&quot; runat=&quot;server&quot; SkinID=&quot;grdlnkBtnWhite&quot; CommandName=&quot;Approve&quot; CommandArgument='&lt;%# Eval(&quot;D_requestdetailID&quot;) %&gt;'&gt;Approve&lt;/asp:LinkButton&gt; &lt;/AlternatingItemTemplate&gt; &lt;FooterTemplate&gt; &lt;asp:LinkButton ID=&quot;lbtnAppAll&quot; runat=&quot;server&quot; CommandName=&quot;Approve All&quot;&gt;Approve All&lt;/asp:LinkButton&gt; &lt;/FooterTemplate&gt; &lt;ItemStyle Width=&quot;12%&quot;&gt;&lt;/ItemStyle&gt; &lt;ItemTemplate&gt; &lt;asp:LinkButton ID=&quot;lnkApprove&quot; runat=&quot;server&quot; CommandName=&quot;Approve&quot; CommandArgument='&lt;%# Eval(&quot;D_requestdetailID&quot;) %&gt;'&gt;Approve&lt;/asp:LinkButton&gt; &lt;/ItemTemplate&gt; &lt;/asp:TemplateField&gt; &lt;asp:TemplateField HeaderText=&quot;Rejection&quot;&gt; &lt;AlternatingItemTemplate&gt; &lt;asp:LinkButton ID=&quot;lnkReject&quot; runat=&quot;server&quot; SkinID=&quot;grdlnkBtnWhite&quot; CommandName=&quot;Reject&quot; CommandArgument='&lt;%# Eval(&quot;D_requestdetailID&quot;) %&gt;'&gt;Reject&lt;/asp:LinkButton&gt; &lt;/AlternatingItemTemplate&gt; &lt;FooterTemplate&gt; &lt;asp:LinkButton ID=&quot;lBtnRejectAll&quot; runat=&quot;server&quot; CommandName=&quot;Reject All&quot;&gt;Reject All&lt;/asp:LinkButton&gt; &lt;/FooterTemplate&gt; &lt;ItemStyle Width=&quot;10%&quot;&gt;&lt;/ItemStyle&gt; &lt;ItemTemplate&gt; &lt;asp:LinkButton ID=&quot;lnkReject&quot; runat=&quot;server&quot; CommandName=&quot;Reject&quot; CommandArgument='&lt;%# Eval(&quot;D_requestdetailID&quot;) %&gt;'&gt;Reject&lt;/asp:LinkButton&gt; &lt;/ItemTemplate&gt; &lt;/asp:TemplateField&gt; &lt;/Columns&gt; &lt;/asp:GridView&gt;</pre> <p>and in this way i am trying to show and hide cells but not working..i am calling this method in pageload grirview related paert is here</p> <pre class="prettyprint"> gvRequestDetail.DataSourceID = ""; gvRequestDetail.DataSource=oDs.D_requests_details; gvRequestDetail.DataBind(); gvRequestDetail.ShowFooter = true; gvRequestDetail.FooterRow.Cells[0].Style.Add("display", "none"); gvRequestDetail.FooterRow.Cells[1].Style.Add("display", "none"); gvRequestDetail.FooterRow.Cells[2].Style.Add("display", "none");</pre> <p></p> <p><br> &nbsp;</p> 2012-05-08T03:20:39-04:004969927http://forums.asp.net/p/1800993/4969927.aspx/1?Re+how+to+hide+some+cells+of+footer+rowRe: how to hide some cells of footer row <p>Hi</p> <pre class="prettyprint">// Gets the footer row directly GridViewRow row = gvRequestDetail.FooterRow;</pre> <pre class="prettyprint">//you can find any control in footer like this var listName = ((TextBox)row.FindControl("txtlistname")).Text;</pre> <p><span face="Verdana" size="2" style="font-family:Verdana; font-size:small"><span face="Verdana" size="2" style="font-family:Verdana; font-size:small"><span face="Courier New" style="font-family:Courier New"><span style="font-size:10pt; color:#008000; font-family:Courier New"></span><span style="font-size:10pt; color:#000000; font-family:Courier New">Hope this helps<br> </span></span></span></span></p> 2012-05-08T03:42:06-04:004969936http://forums.asp.net/p/1800993/4969936.aspx/1?Re+how+to+hide+some+cells+of+footer+rowRe: how to hide some cells of footer row <p>make false here in the higlighted line</p> <p></p> <p><strong>1) gvRequestDetail<span class="pun">.</span><span class="typ">ShowFooter</span><span class="pln"></span><span class="pun">=</span><span class="pln"> </span><span class="kwd">false</span><span class="pun">;</span><span class="pln">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></strong></p> <p><span class="pln">gvRequestDetail</span><span class="pun">.</span><span class="typ">FooterRow</span><span class="pun">.</span><span class="typ">Cells</span><span class="pun">[</span><span class="lit">0</span><span class="pun">].</span><span class="typ">Style</span><span class="pun">.</span><span class="typ">Add</span><span class="pun">(</span><span class="str">&quot;display&quot;</span><span class="pun">,</span><span class="pln"></span><span class="str">&quot;none&quot;</span><span class="pun">);</span><span class="pln">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></p> <p><span class="pln">gvRequestDetail</span><span class="pun">.</span><span class="typ">FooterRow</span><span class="pun">.</span><span class="typ">Cells</span><span class="pun">[</span><span class="lit">1</span><span class="pun">].</span><span class="typ">Style</span><span class="pun">.</span><span class="typ">Add</span><span class="pun">(</span><span class="str">&quot;display&quot;</span><span class="pun">,</span><span class="pln"></span><span class="str">&quot;none&quot;</span><span class="pun">);</span><span class="pln">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></p> <p><span class="pln">gvRequestDetail</span><span class="pun">.</span><span class="typ">FooterRow</span><span class="pun">.</span><span class="typ">Cells</span><span class="pun">[</span><span class="lit">2</span><span class="pun">].</span><span class="typ">Style</span><span class="pun">.</span><span class="typ">Add</span><span class="pun">(</span><span class="str">&quot;display&quot;</span><span class="pun">,</span><span class="pln"></span><span class="str">&quot;none&quot;</span><span class="pun">);</span></p> <p></p> <p><strong>2) also remove showfooter = true in the design</strong></p> 2012-05-08T03:59:18-04:004969971http://forums.asp.net/p/1800993/4969971.aspx/1?Re+how+to+hide+some+cells+of+footer+rowRe: how to hide some cells of footer row <pre class="prettyprint">I have worked with your code. Please try with the following code snippet. Hopefully, it will work as desired.</pre> <pre class="prettyprint">this.gvRequestDetail.FooterRow.Cells[0].Style.Add("visibility", "hidden"); //For invisible this.gvRequestDetail.FooterRow.Cells[0].Style.Add("visibility", "visible"); //For visible</pre> <pre class="prettyprint"><span class="atv"><br /></span></pre> <p></p> 2012-05-08T04:37:25-04:004970140http://forums.asp.net/p/1800993/4970140.aspx/1?Re+how+to+hide+some+cells+of+footer+rowRe: how to hide some cells of footer row <p>ENOUGH :-( every solution works once...i have saved every thing but when i compile and execute code again it stop working</p> <p>what to do...</p> 2012-05-08T06:05:26-04:004976818http://forums.asp.net/p/1800993/4976818.aspx/1?Re+how+to+hide+some+cells+of+footer+rowRe: how to hide some cells of footer row <p>Do you DataBind only when !IsPostBack?</p> <p>And what about adding the style?</p> <p>GridView Cells may not remember the style you set like this on PostBack.</p> <p>&nbsp;</p> <p>ShowFooter will only affect what DataBind does. So it must be set before the call to DataBind.&nbsp;</p> <p>&nbsp;</p> 2012-05-11T15:22:12-04:00