Hi all,

I'm adding  an SPGridView to a web part on a site's homepage via code which
references a custom Contacts list.

This works very nicely but the formatting is slightly limited.

What I'm struggling to do is bind two list field values to a single grid
column - i.e. First and Last name. Is this possible?

Current CReateChildControls elements:

            myGridView = new SPGridView();
            myGridView.Enabled = true;
            myGridView.AutoGenerateColumns = false;

            SPBoundField colFirst = new SPBoundField();
            colFirst.DataField = "First Name";
            colFirst.HeaderText = "Name";
            colFirst.HeaderStyle.HorizontalAlign = HorizontalAlign.Left;
            this.myGridView.Columns.Add(colFirst);

            SPBoundField colLast = new SPBoundField();
            colLast.DataField = "Last Name";
            colLast.HeaderText = "Last Name";
            colLast.HeaderStyle.HorizontalAlign = HorizontalAlign.Left;
            this.myGridView.Columns.Add(colLast);

            this.Controls.Add(myGridView);

If so, how? :0 I can't find any good examples of this. Have tried combining
all in a new control - e.g. First + " " + Last - but can't seem to
find a field type that will allow both SPBoundFields and Literals. :(

Regards,

Paul

SharePoint Farm Admin/Developer
Infrastructure Team
CEO Sydney

p: (02) 9568 8461
f: (02) 9568 8483
e: paul.no...@syd.catholic.edu.au
w: http://www.ceosyd.catholic.edu.au/
_______________________________________________
ozmoss mailing list
ozmoss@ozmoss.com
http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss

Reply via email to