Professional Web Applications Themes

Linkbutton does not look like a linkbutton - ASP.NET Data Grid Control

OK, I almost got my problem solved. Zen is almost there! Just that a LinkButton control inside a column in my datagrid doesn't show like a link button. It does not have an underlining. My client side JavaScript is enabled. How do I make the button underlined and appear and act like a linkbutton? Currently, it just displays the text like a normal label/table cell that has a label....

  1. #1

    Default Linkbutton does not look like a linkbutton

    OK, I almost got my problem solved. Zen is almost there! Just that a
    LinkButton control inside a column in my datagrid doesn't show like a
    link button. It does not have an underlining. My client side JavaScript
    is enabled. How do I make the button underlined and appear and act like
    a linkbutton? Currently, it just displays the text like a normal
    label/table cell that has a label.

    Sathyaish Guest

  2. #2

    Default Re: Linkbutton does not look like a linkbutton

    It looks like the LinkButton cannot be databound. If it is, it just
    disappears. As a test, I tried this:

    <asp:TemplateColumn HeaderText="Full Name">
    <ItemTemplate>
    <asp:LinkButton OnClick="dg_ItemCommand">
    <%# DataBinder.Eval(Container.DataItem, "Full Name")%>
    </asp:LinkButton>
    </ItemTemplate>
    </asp:TemplateColumn>


    The column displays the correct full name value but no underlining. I
    am guessing that the grid replaced the linkbutton with a literal
    control. I did this and found out.

    lblMessage.Text = dg.Items(1).Cells(0).Controls(0).GetType.ToString

    in a button_click.


    Then, I tried this:

    <asp:LinkButton id="lnk" style="Z-INDEX: 104; LEFT: 432px; POSITION:
    absolute; TOP: 80px" runat="server">The date and time is: <%#
    System.DateTime.Now.ToLongDateString %></asp:LinkButton>

    And it only showed the link button with the text

    The date and time is:


    How do I have a control in a grid that:

    (1) Is DataBound
    (2) Appears and acts like a linkbutton
    (3) Does not behave like the ItemTemplate's EditItem where you have
    those edit textboxes inside the grid itself.

    Sathyaish Guest

Similar Threads

  1. LinkButton question
    By treilly via DotNetMonster.com in forum ASP.NET Data Grid Control
    Replies: 0
    Last Post: November 14th, 08:52 PM
  2. Adding CSS to LinkButton
    By Maziar Aflatoun in forum ASP.NET Data Grid Control
    Replies: 2
    Last Post: February 15th, 05:58 PM
  3. Problem with LinkButton and AddAttributesToRender
    By Henri in forum ASP.NET Building Controls
    Replies: 0
    Last Post: October 3rd, 05:51 PM
  4. LinkButton
    By Hugo Flores in forum ASP.NET General
    Replies: 4
    Last Post: July 4th, 08:01 PM
  5. Format of LinkButton..?
    By Onur Bozkurt in forum ASP.NET General
    Replies: 1
    Last Post: July 1st, 07:15 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139