Welcome Guest Search | Active Topics | Sign In | Register

Refresh the data in the Dialog when the page performs a postback Options
The Menace
Posted: Monday, September 22, 2008 3:02:54 PM
Rank: Member
Groups: Member

Joined: 6/2/2008
Posts: 14
I have a scenario where a dialog box is added to each gridview and on each row, it has a link to open up the dialog box. My problem is, when I do a save the page, the dialog's data which contains a preview of what the main gridview is doesn't get the most recent data unless I do another post back on the page.

I set the viewstate = false to the gridview, the form itself, the panel that's within the dialog that holds the gridview and including the dialog itself but nothing works. I want the dialog to get/load the most recent saved information when I save the form. Any ideas? Thanks for the help.
eo_support
Posted: Monday, September 22, 2008 3:11:38 PM
Rank: Administration
Groups: Administration

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

I assume that you use ContentUrl to display the content in the dialog. If this is the case, this mostly has to do with the page caching. Details about page caching would be out of the scope of our support, but you should be able to find plenty of information about it if you Google it.

Thanks
The Menace
Posted: Monday, September 22, 2008 3:20:18 PM
Rank: Member
Groups: Member

Joined: 6/2/2008
Posts: 14
I use the content template. Is that the same as Content URL?

Code: HTML/ASPX
<ContentTemplate>
        <div style="text-align: left;">
            <asp:placeholder id="plcData" runat="server" EnableViewState="False"></asp:placeholder>
        </div>
    </ContentTemplate>


eo_support
Posted: Monday, September 22, 2008 3:56:37 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,090
No. They are not the same. In that case the content of the dialog is rendered when the page is rendered, not when the dialog is displayed. So whatever problem you are running into should be addressed there. As a simple test, you can put the PlaceHolder outside of the dialog and you should see the same result.
The Menace
Posted: Monday, September 22, 2008 4:18:46 PM
Rank: Member
Groups: Member

Joined: 6/2/2008
Posts: 14
Is there a way that I can render the dialog only or when when the linkbutton is clicked? This way, the content of the dialog contains the latest data.
eo_support
Posted: Monday, September 22, 2008 4:45:00 PM
Rank: Administration
Groups: Administration

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

Since you render the dialog content with server side code, the key to when the dialog is updated is when your server side code is called, this in turn means when your page is regenerated by the server.

By default displaying the dialog does not post back the page to the server. So your server side code will not run. You can do a full page post back by putting a regular button field in your GridView and NOT associated it with the dialog in anyway (for example, not setting the dialog’s StartButton). This way when user clicks the button field, the page is posted back. You can then update the content of the dialog and also set the dialogs’ InitialState to “Visible” to display the dialog in your server side event handler.

You can also devise other mechanism to update the dialog, such as AJAX. But the key of updating dialog contents pretty much has nothing particular to do with the dialog. You are updating your page content and you need to use whatever mechanism you use to update page contents to update the dialog content.

Hope this helps.

Thanks
The Menace
Posted: Wednesday, September 24, 2008 9:06:27 AM
Rank: Member
Groups: Member

Joined: 6/2/2008
Posts: 14
That works, thanks.

I guess the keyword here is "InitialState", not "Visible" just an FYI to the users who are trying to accomplish the same thing when opening up the dialog box.
eo_support
Posted: Wednesday, September 24, 2008 10:07:23 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,090
The Menace wrote:
I guess the keyword here is "InitialState", not "Visible" just an FYI to the users who are trying to accomplish the same thing when opening up the dialog box.


Yes. InitialState is the key. Thanks for the update!


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.