WebFlyPostBackManager and Column heading background in WebGrid

11 replies. Last post: October 31, 2014 2:30 AM by Hans Kristian
Tags :
  • (None)
  • New Discussion
  • New Question
  • New Product Feedback

For further information refere to never solved case IS-5104B939-47A2-40CE-A43D-4A8D67C8B76D from early this year.

I have a page with a WebGrid and FlyPostBack Manager with EnableUIMode="True". The web grid is created dynamicaly on each request, so the number of column is dynamic. I have to color the column headings. Let us say in the first request there are 4 columns with those column headings:

Col1 = Blue
Col2 = Red
Col3 = Yellow
Col4 = default color (no color set)

In the second request let us say the columns are only 3 setup in code behind with those colors: 

Col1 = Blue
Col2 = Red
Col3 = default color (no color set)

Unfortunately Col3 now shows up with yellow color (from the first request). To solve this problem I tried something like this as I expected this is happening because the layout of the grid is not posted back to the client (because of the WebFlyPostBack Manager):

//Flypostback event server side

WebFlyPostBackManager1.ClientAction.InvokeScript("SetDefaultStyle()");

//Client side event

function SetDefaultStyle()
{
var WebGrid1 = ISGetObject("WebGrid1");
WebGrid1.RootTable.Columns[2].GetElement().style.backgroundColor = "#D4DDEA";
WebGrid1.RootTable.Columns[2].GetElement().style.backgroundImage = "url(ISRes.axd?G/wg5_bk_pro.gif)";
}

However that does not help.

Im using 2008 R1 and the webgrid is using "Elegant style".

How can I solve this issue?

All times are GMT -5. The time now is 11:39 PM.
Previous Next