DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: SHOWING IMAGE & TEXT WHEN SORTING IN DATAGRID

  1. #1
    chandra babu Guest

    SHOWING IMAGE & TEXT WHEN SORTING IN DATAGRID


    Dear dudes,

    I got some problem while handling image in datagrid.
    Actually my requirement is,image will be shown in the
    header to understand whether the sorting is ASC or DESC.

    I need to change the image dynamically based on the sorting with text.
    So i wrote a function getImage().Now i placed the function inside bound column.If
    i try to run the program is giving error.


    The error is
    Compiler Error Message: BC30676: 'DataBinding' is not an event of 'System.Web.UI.WebControls.BoundColumn'.


    function code:

    Public Function getImage() As String
    If viewstate("SortDirection") Is Nothing Then
    Return "Firsname<img border=0 src=Asc.bmp>"
    Else
    Return "Firsname<img border=0 src=Desc.bmp>"
    End If
    End Function


    Datagrid definition:

    <asp:datagrid id="DataGrid1" runat="server" ShowHeader="True" AllowSorting=True
    AutoGenerateColumns="False" CellPadding="2" CellSpacing="2" BorderStyle="solid"
    BorderColor="black" ForeColor="Black" font-size="x-small" font-names="Verdana"
    width="100%" PagerStyle-HorizontalAlign="Right">
    <HeaderStyle ForeColor="White" BackColor="brown" Font-Bold="true" />
    <Columns>
    <asp:BoundColumn DataField="FirstName" SortExpression="FirstName" headerText='<%#
    getimage%>' readonly="True"></asp:BoundColumn>
    <asp:BoundColumn DataField="LastName" HeaderText="LastName"></asp:BoundColumn>
    </Columns>
    </asp:datagrid>


    What could be the problem?
    If you have any other idea please let me know.

  2. #2
    Phil Weber Guest

    Re: DataGrid

    Abot: I have moved your message to the vb.dotnet.technical group, where it
    is more likely to receive a reply. Thanks!
    --
    Phil Weber


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center