Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

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

  • 21-02-2007 1: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,300 ✭✭✭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