Welcome Guest Search | Active Topics | Sign In | Register

Grid not keeping values when using Placeholders Options
abrea
Posted: Tuesday, October 7, 2008 7:17:52 AM
Rank: Member
Groups: Member

Joined: 7/12/2008
Posts: 19
I am using a Grid that is binded to a database. The enableviewstate is true but when I disable the placeholder that contains the grid and then re-enable it, all values in the grid disappers and I am presented with an empty grid.

Can you please tell me how to fix this issue?
eo_support
Posted: Tuesday, October 7, 2008 7:22:23 AM
Rank: Administration
Groups: Administration

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

Can you tell us what you mean by "disable the placeholder"?

Thanks
abrea
Posted: Tuesday, October 7, 2008 7:45:51 AM
Rank: Member
Groups: Member

Joined: 7/12/2008
Posts: 19
What I mean by deactivate the placeholder is by running the following code:

placeholder1.enabled = false

I then activate another place holder:

placeholder2.enabled = true

Once a button has been pressed I reactivate placeholder1 that contains my grid.

placeholder1.enabled = true

placeholder2.enabled = false

All other objects are displayed with their values intact except for the grid. I shoud also mention that I am using a tabstrip and the grid exist with in a tab.
eo_support
Posted: Tuesday, October 7, 2008 9:27:49 AM
Rank: Administration
Groups: Administration

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

We have confirmed this to be a problem. We will try to provide a fix or a workaround as soon as possible.

Thanks!
abrea
Posted: Tuesday, October 7, 2008 9:31:26 AM
Rank: Member
Groups: Member

Joined: 7/12/2008
Posts: 19
Thak you
eo_support
Posted: Tuesday, October 7, 2008 9:35:31 AM
Rank: Administration
Groups: Administration

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

You mentioned that "all other objects are displayed with their values intact". However our test also indicates a simple TextBox control would lose its value as well. Can you try the same and let us know whether the same occurs for you?

Thanks
abrea
Posted: Tuesday, October 7, 2008 10:41:25 AM
Rank: Member
Groups: Member

Joined: 7/12/2008
Posts: 19
All textboxes are intact for me. I have several textboxes on the screen.
Sorry, i made one mistake, iIam using placeholder.visible = false and placeholder.visible = true, not enable.
eo_support
Posted: Tuesday, October 7, 2008 11:17:01 AM
Rank: Administration
Groups: Administration

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

There is a huge difference between "Visible" and "Enabled". :) In fact during our test we had to use a Panel instead of a PlaceHolder to set Enabled because PlaceHolder does not have Enabled property. :)

Grid does discard all information if you do not render it at all (When "Visible" is false). Regular ASP.NET control stores the control data in ViewState, which is always rendered regarldess whether the control itself is rendered. Grid on the other hand does not do so. The reason is because unlike simple control like TextBox, Grid contains a lot of data. So storing all Grid data in ViewState and render it down to the client side regardless whether the Grid itself is rendered pose a huge performance penalty. For this reason, we opted to a “no Grid, no data” implementation. This gives the best perforance and works well for most scenarios. But it does pose a problem for your scenario, where you want to hide the Grid but keep the Grid data.

There are several ways to work around this. The “cleanest” way (also might be the most complicated, unfortunately) is for you to repopulate the Grid when you want to display the Grid again. The easiest way is to hide the PlaceHolder without actually setting its Visible to false. In order to do this, you will need to:

1. Replace PlaceHolder control with a Panel control. This is necessary because PlaceHolder does not render any HTML elements, where as Panel is usually rendered as a DIV;
2. Use "display" style attribute to show/hide the Panel. For example, the following code hide the Panel:

Code: C#
Panel1.Style[“display”] = “none”;


The following code shows the panel:

Code: C#
Panel1.Style[“display”] = “block”;


This should keep the Grid rendered (along with all data) but make it invisible on the screen.

Hope this helps.

Thanks

abrea
Posted: Tuesday, October 7, 2008 1:06:58 PM
Rank: Member
Groups: Member

Joined: 7/12/2008
Posts: 19
I will give a shoot. I am not familiar with, so my only concerns will it make it invisible but save the space, or will it move everythin up like Placeholder.
eo_support
Posted: Tuesday, October 7, 2008 1:13:27 PM
Rank: Administration
Groups: Administration

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

When you use "display:none" visually it will work pretty much like having Visible set to false. You can try this on a few simple HTML elements to get an idea how it work:

Code: HTML/ASPX
<div style="display:none">
Hello!
</div>


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.