Welcome Guest Search | Active Topics | Sign In | Register

Grid StaticColumn issue - Text changing and Fixed Top Rows Options
RB0135
Posted: Monday, October 7, 2013 7:11:56 AM
Rank: Member
Groups: Member

Joined: 9/26/2013
Posts: 23
Hi All,

I have a grid, 3 rows at the top are fixed.

All columns dynamically created in Code Behind.

My 3rd column is a static column.

This Static column text has 6 options and it is not bound to any data field. The user can click and each one fires a JavaScript routine. This works perfect.

Code: C#
EO.Web.StaticColumn oBUCol3 = new EO.Web.StaticColumn();
oBUCol3.Name = "BU-ITEMS";
oBUCol3.Text = "<a href=\"javascript:bu_raisesGridEvent('SelectE')\">[E]</a><a href=\"javascript:bu_raisesGridEvent('SelectH')\">[H]</a><a href=\"javascript:bu_raisesGridEvent('SelectI')\">[I]</a><a href=\"javascript:bu_raisesGridEvent('SelectC')\">[C]</a><a href=\"javascript:bu_raisesGridEvent('SelectS1')\">[S1]</a><a href=\"javascript:bu_raisesGridEvent('SelectALL')\">[ALL]</a>";


Anyway, ROW 3, COLUMN 3 (the static column), I need to show different text to what is created Dynamically. I tryed to change the text Dynamically after the row is created in Code behind, but it wont change (other columns do).

I didn't have the latest build, and the build I was using showed the dynamic created text (above) in the 3 Fixed rows which I don't need.

However, I just installed the latest version, and now the top 2 out of 3 rows are blank in the Static Column (which is what I want) but not the 3rd row.

1) Why cant I change the Text (yes, I know it is static, but I should still be able to change it)
2) Is a StaticColumn the best to use, or should I create a Custom Column like a label column

Any ideas greatly appreciated
eo_support
Posted: Monday, October 7, 2013 9:25:54 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,195
Hi,

Have you tried to use something like this:

Code: C#
Grid1.Items[0].Cells[0].Value = "something";


When you set Text to the GridColumn, it applies all cell to the column. When you set Value to the GridCell, it affect only that cell.

Thanks!
RB0135
Posted: Monday, October 14, 2013 2:05:21 AM
Rank: Member
Groups: Member

Joined: 9/26/2013
Posts: 23
Ok, thanks for that reply...

I am trying to set the value like this:

Code: C#
EO.Web.GridItem newItem = BU_EOGrid.CreateItem();

newItem.Cells[0].ColSpan = 3;
newItem.Cells[0].Value = "";
newItem.Cells[1].Value = "";
newItem.Cells[2].Value = "";
newItem.Cells[3].ColSpan = _dtBU.Rows.Count - 1;
newItem.Cells[3].Value = "BUSINESS AREAS";

BU_EOGrid.Items.Add(newItem);


As I presumed that I can set the Value needed on the new item before it was added to the grid.

But, are you saying, add the newitem (row) and then configure the values. Do you do that after the databind command (EG in this case BU_EOGrid.DataBind(); or after the newitem (row) has been added?

Thanks again
eo_support
Posted: Monday, October 14, 2013 1:39:13 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,195
Hi,

By definition, a call to DataBind wipes everything that's already in the Grid and recreate all items from your data source. So whatever changes you made by code before DataBind has no effect.

Thanks!
RB0135
Posted: Monday, October 14, 2013 9:00:51 PM
Rank: Member
Groups: Member

Joined: 9/26/2013
Posts: 23
Ok, but in this case, I am not binding from a data source. Because I have to "make up" the Grid data from disparate datasources and apply rules, then I simple have to add the rows as I am doing manually.

Actually, that makes me think then, why am I calling BU_EOGrid.Databind()... Just removed that and it is the same.

I tried you grid1.items[0].... idea and got the same results as I did, assigning as I went in the newitem.

I was able to get the desired result by not assigning anything in the Static Column (well, I made a Custom Label Colum) then used the ClientSideGetText routine and if the row was <= 2, set the value to empty string but if it was greater than 2, set the text to my 6 command options I needed.

It works perfectly.

Thanks.
eo_support
Posted: Tuesday, October 15, 2013 9:16:36 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,195
Hi,

Glad that you got it working!

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.