Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

c# help :: Invisible DataGrid Table Rows?? Beginner

  • 21-02-2007 02:57PM
    #1
    Closed Accounts Posts: 10


    I have written some code (below) and it reads values from image button ToolTips on a floorplan and returns the results accordingly. I'm having a problem though, I don't want to display all the values in the table. I have no idea how to invisiblise these rows.

    I presume there is a better way to display the results that will give me more control.



    ds = new DataSet();

    myda.Fill(ds, "tbl_tablename");

    HtmlTableRow trow;

    HtmlTableCell tcell;

    foreach (DataRow dr in ds.Tables[0].Rows)

    {

    trow = new HtmlTableRow();

    foreach (DataColumn dc in ds.Tables[0].Columns)

    {

    tcell = new HtmlTableCell();

    tcell.Controls.Add(new LiteralControl(dr[dc.ColumnName].ToString()));

    trow.Cells.Add(tcell);

    }

    tblItems.Rows.Add(trow);

    }

    I am a total beginner so sorry in advance....


Comments

  • Registered Users, Registered Users 2 Posts: 7,468 ✭✭✭Evil Phil


    Is this version 1.1 or 2.0? Either way I'd use data binding to do this. While there are some performance gains to generating the HTML on the fly I doubt it's an issue here.

    If it's 1.1 look at DataGrids, if it's 2.0 look at GridViews. These server controls will manage generate the HTML for you and allow you to control what fields are displayed and how.


  • Closed Accounts Posts: 10 eventz_user


    Thanks Evil Phil. Version 2.0.
    Will look into Grid Views. Do you by any chance have a link to some useful article??
    :)


  • Registered Users, Registered Users 2 Posts: 7,468 ✭✭✭Evil Phil


    Google 'GridView Tutorial asp.net' and you should get loads.


  • Registered Users, Registered Users 2 Posts: 2,285 ✭✭✭PixelTrawler


    Thanks Evil Phil. Version 2.0.
    Will look into Grid Views. Do you by any chance have a link to some useful article??
    :)

    This is exactly what ur looking for http://quickstarts.asp.net/QuickStartv20/aspnet/doc/data/default.aspx


  • Closed Accounts Posts: 10 eventz_user


    Thanks guys, meant to post earlier... i got it working!


  • Advertisement
Advertisement