Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Problem with add linkbutton to a footer of a gridview runtime!!!

Problem with add linkbutton to a footer of a gridview runtime!!!

Scheduled Pinned Locked Moved C#
helphtmlsysadminquestion
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    Nafiseh Salmani
    wrote on last edited by
    #1

    I use the following code to add linkbutton to footer of a grideview, but it cause error sometimes!!!!! In my computer as local server it works, but another users see the error.

    LinkButton lbtn = new LinkButton();
    lbtn.Text = " |< ";
    Panel pnl = GridView1.FooterRow.FindControl("pnlFooter") as Panel ;
    lbtn.CommandArgument = (pageindex).ToString();
    lbtn.Command += new CommandEventHandler(lbtn_Command);
    pnl.Controls.Add(lbtn);

    the error accurs at line

    Panel pnl = GridView1.FooterRow.FindControl("pnlFooter") as Panel ;

    what could I do to solve it?!!!! :doh: any help would be useful!! HTML For footer gridview:

    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" AllowPaging="False" GridLines="None" ShowHeader="False" onpageindexchanged="GridView1_PageIndexChanged" ShowFooter="True" FooterStyle-Font-Bold="True">
    <Columns>
    asp:TemplateField
    <ItemTemplate>
    <table style="width:100%">
    <tr>
    <td>

                        <!-- <asp:LinkButton Text='<%# Eval("Title")  %>' ID="libtnGRV" CommandArgument='<%# Eval("URLProduct") +"&Companyurl="+ Eval("URLCompany")%>' runat="server" oncommand="libtnGRVcommand" Font-Bold="True"></asp:LinkButton>-->
                         <!--<a href='<%# Eval("Title")  %>' style="text-decoration: none; font-weight: bold" runat="server"><%# Eval("Title")  %></a>-->
                         <asp:HyperLink ID="HyperLink1" runat="server" 
                                 NavigateUrl='<%# "ShowProductDetails.aspx?ARG="+(Eval("URLProduct") +"&Companyurl="+ Eval("URLCompany")).Replace("./?", "http://www.sme.ir/&") %>' 
                                 Text='<%# Eval("Title") %>' Font-Bold="True"></asp:HyperLink>
                         </td>
                         </tr>
                         <tr>
                         <td>
                         <label runat="server" visible="false"><%# Eval("Price")%></label>
                             
                         </td>
                         </tr>
                         <tr><td>
                     <!--    <a href='<%# Eval("URLCompany") %>' runat=
    
    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups