Adding data bound controls to a grid programatically

Discussion in 'ASP .Net Datagrid Control' started by AsciiSmoke@gmail.com, Jul 3, 2006.

  1. Guest

    Hi guys,

    Please bear with me I'm still pretty green with Asp.Net and I'll
    probably use some wrong terminology here.

    I'm trying to reproduce, in ASP.Net, the look of a results list in a
    regular ASP site I built a while back
    (http://www.rpcushing.co.uk/cart/results.asp). I'm currently tearing my
    hair out trying to use the web versions of the Infragistics controls
    that others in my company use in windows forms apps.

    Basically I've got a dataset from an external web service and I'm
    trying to bind that data into a grid control and overide the grid
    layout with the 'card-view' type approach as seen in the url above so
    that I can make use of the paging and re-sorting built into the
    control.

    My approach is to bind the dataset to the grid and then hide the
    columns. Then, add a new column into which I want so squirt a custom
    control that holds the markup to draw a card instance.

    As a test I'm preliminarily just trying to insert a Label into the new
    column, but I'm getting an error saying that this control is not
    serializable. I'm afraid I don't even know what that means. No-one here
    has time to help me out, so your my only hope! Everything I've learnt
    so far has been a mishmash of books and trial-and-error so there's some
    pretty gaping holes in my knowledge.

    Here's my code so far, I don't have to use the Infragistics grid if
    there is a better control:


    ResultsGrid.DataSource = GridData;
    ResultsGrid.DataBind();

    for (int xx = 0; xx < ResultsGrid.Columns.Count; xx++)
    {
    if (ResultsGrid.Columns[xx].Key.ToString() != "JOBID" &&
    ResultsGrid.Columns[xx].Key.ToString() != "JOBTITLE" &&
    ResultsGrid.Columns[xx].Key.ToString() != "LOCATIONDESCRIPTION")
    {
    ResultsGrid.Columns[xx].Hidden = true;
    }
    }

    UltraGridColumn tmpNewcolumn = new UltraGridColumn("JSN_ResultsItem",
    "Job Shop Net", ColumnType.Custom, "");
    ResultsGrid.Columns.Add(tmpNewcolumn);
    //ResultsGrid.Columns.Add("JSN_ResultsItem", "");
    for (int yy = 0; yy < ResultsGrid.Rows.Count; yy++)
    {
    System.Web.UI.WebControls.Label tmpLabel = new
    System.Web.UI.WebControls.Label();
    tmpLabel.Text = "Record " + yy.ToString();
    ResultsGrid.Rows[yy].Cells.FromKey("JSN_ResultsItem").Value = new
    System.Web.UI.WebControls.Label();
    }
    , Jul 3, 2006
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. C Newby
    Replies:
    7
    Views:
    568
    C Newby
    Apr 2, 2004
  2. sunil panda

    Lower bound & Upper bound

    sunil panda, Dec 25, 2003, in forum: Java
    Replies:
    9
    Views:
    7,232
    thushara wijeratna
    Oct 7, 2008
  3. Rhiner Dan
    Replies:
    1
    Views:
    742
    Mike Wahler
    Mar 27, 2005
  4. Mario Krsnic
    Replies:
    0
    Views:
    376
    Mario Krsnic
    Jun 23, 2006
  5. Phillip Vong
    Replies:
    0
    Views:
    413
    Phillip Vong
    Jul 27, 2006
Loading...

Share This Page