Adding data bound controls to a grid programatically

A

AsciiSmoke

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();
}
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top