Columnspan in Datagrid ?

Discussion in 'ASP .Net' started by ajaymehra, Feb 6, 2004.

  1. ajaymehra

    ajaymehra Guest

    Hi,
    I am using a dataview as my datagrids datasource and binding i
    dynamically.
    Can I specify a column span for a single row of a datagrid?

    Thanks in advance,
    Aja

    ajaymehr
     
    ajaymehra, Feb 6, 2004
    #1
    1. Advertisements

  2. sure,
    do so in the itemdatabound. each row gets bound in this event so you can
    pick your row, apply column span and then mark that row as dirty so
    columnspan doesn't get applied to every row. Use viewstate for this
    ViewState["DIRTY"] = "True"

    if(e.item.itemtype = = listitem.item)
    {
    if(ViewState["DIRTY"] == null)
    e.item.cells[2].ColumnSpan = 2;
    }

    roughly
     
    Alvin Bruney [MVP], Feb 6, 2004
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.