DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Empty DataList

  1. #1
    Liming Guest

    Empty DataList


    Hi all,

    I have a empty DataList, such I want to display a message inside a <ItempTemplate>
    or similar tags.. but there is no things like <emptyItemTemplate>.. so how
    should I approach this? My graphic designer won't make any compromises..
    the "No data avaiable" messages has to be in between <headtempelater> and
    <footertemplate>.

    Thanks a lot.



  2. #2
    michael Guest

    Re: Empty DataList


    Haven't messed with the datalist, but quite a bit with the datagrid. What
    I do is create a new datasource and databind it to the grid on the fly.
    e.g.

    if MainDataTable.Rows.Count.Equals(0) then
    Dim dt as DataTable
    dim r as DataRow
    dt = New DataTable
    dt.columns.add("EmptyList", Type.GetType("System.String")
    r = dt.NewRow
    r(0) = "Unable to obtain the requested data."
    dt.Rows.Add(r)
    myDataGrid.ShowHeader = False
    myDataGrid.DataSource = dt
    myDataGrid.DataBind
    end if

    Hope this helps,
    Michael

    "Liming" <lmxu@yahoo.com> wrote:
    >
    >Hi all,
    >
    >I have a empty DataList, such I want to display a message inside a <ItempTemplate>
    >or similar tags.. but there is no things like <emptyItemTemplate>.. so how
    >should I approach this? My graphic designer won't make any compromises..
    >the "No data avaiable" messages has to be in between <headtempelater> and
    ><footertemplate>.
    >
    >Thanks a lot.
    >
    >



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