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. Web Development
  3. ASP.NET
  4. GridView Image button

GridView Image button

Scheduled Pinned Locked Moved ASP.NET
csharphtmlasp-netsysadmindocker
4 Posts 2 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.
  • A Offline
    A Offline
    Abbas_here
    wrote on last edited by
    #1

    hi freds.. I am facing an issue in gridview control(asp.Net,c#), see below code panel

    <asp:TemplateField HeaderText="Action">
    <ItemTemplate>

                                        <asp:ImageButton ID="imgLiveTest" CommandName="<%#DataBinder.Eval(Container.DataItem,"type")%>"
                                            ImageUrl='<%# GetImageTestLive(DataBinder.Eval(Container.DataItem,"liveServer")) %>'
                                            OnClick="imgLiveTest\_click" runat="server" />
                                   
                                        <asp:ImageButton ID="Edit" CommandName="<%#DataBinder.Eval(Container.DataItem,"type")%>"
                                            OnClick="Edit\_click" ImageUrl="images/edit.gif" runat="server" />
                                   
                                        <asp:ImageButton ID="Delete" CommandName="<%#DataBinder.Eval(Container.DataItem,"type")%>"
                                            OnClick="delete\_click" ImageUrl="images/cancel.gif" runat="server" />
                                    
                        </ItemTemplate>
                    </asp:TemplateField>
    

    But I am not able to to see image in gridview, where as path is correct, and in source code ImageButton not renderd as html code they are same as aspx. Thanks, Abbas

    A 1 Reply Last reply
    0
    • A Abbas_here

      hi freds.. I am facing an issue in gridview control(asp.Net,c#), see below code panel

      <asp:TemplateField HeaderText="Action">
      <ItemTemplate>

                                          <asp:ImageButton ID="imgLiveTest" CommandName="<%#DataBinder.Eval(Container.DataItem,"type")%>"
                                              ImageUrl='<%# GetImageTestLive(DataBinder.Eval(Container.DataItem,"liveServer")) %>'
                                              OnClick="imgLiveTest\_click" runat="server" />
                                     
                                          <asp:ImageButton ID="Edit" CommandName="<%#DataBinder.Eval(Container.DataItem,"type")%>"
                                              OnClick="Edit\_click" ImageUrl="images/edit.gif" runat="server" />
                                     
                                          <asp:ImageButton ID="Delete" CommandName="<%#DataBinder.Eval(Container.DataItem,"type")%>"
                                              OnClick="delete\_click" ImageUrl="images/cancel.gif" runat="server" />
                                      
                          </ItemTemplate>
                      </asp:TemplateField>
      

      But I am not able to to see image in gridview, where as path is correct, and in source code ImageButton not renderd as html code they are same as aspx. Thanks, Abbas

      A Offline
      A Offline
      Abhishek Sur
      wrote on last edited by
      #2

      Just right click on the image control (which is rendered as no image) and see if the path that its src has can be accessible by directly putting in the browser. You need to have access previledge to a path from the client to see the image. Also why do you use : ImageUrl='<%# GetImageTestLive(DataBinder.Eval(Container.DataItem,"liveServer")) %>' single quote here while using double quote for all others. :doh:

      Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.


      My Latest Articles-->****
      InfoBox Visual Studio 2010 Extension
      Windows7 API Code Pack
      Simplify Code Using NDepend**

      A 1 Reply Last reply
      0
      • A Abhishek Sur

        Just right click on the image control (which is rendered as no image) and see if the path that its src has can be accessible by directly putting in the browser. You need to have access previledge to a path from the client to see the image. Also why do you use : ImageUrl='<%# GetImageTestLive(DataBinder.Eval(Container.DataItem,"liveServer")) %>' single quote here while using double quote for all others. :doh:

        Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.


        My Latest Articles-->****
        InfoBox Visual Studio 2010 Extension
        Windows7 API Code Pack
        Simplify Code Using NDepend**

        A Offline
        A Offline
        Abbas_here
        wrote on last edited by
        #3

        hi Abhi thanks for answer, actually i was using image path according function returns value, but now we using RowCreated event thats working fine. Thanks,

        A 1 Reply Last reply
        0
        • A Abbas_here

          hi Abhi thanks for answer, actually i was using image path according function returns value, but now we using RowCreated event thats working fine. Thanks,

          A Offline
          A Offline
          Abhishek Sur
          wrote on last edited by
          #4

          Oh this is great to hear that it solved. Cheers :thumbsup:

          Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.


          My Latest Articles-->****
          InfoBox Visual Studio 2010 Extension
          Windows7 API Code Pack
          Simplify Code Using NDepend**

          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