|
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.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,193
|
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
|
|
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>
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,193
|
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.
|
|
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.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,193
|
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
|
|
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.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,193
|
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!
|
|