Hi, I am having a problem with the dialog causing the page postbacks when I set the contenturl address in javascript on the client. Other Ajax behavior works OK (such as sorting, etc...), but as soon the call to dlg.get_contentPane().set_contentUrl("ViewonlyRecord.aspx?r=" + v); is executed the browser does a full page postback. I verified this by commenting only this line and no more postbacks.
The wanted behavior is to display a record view page when the record's row is double-clicked in the grid, how can I accomplish this without the full postback?
The below code is abbreviated but the basic structure is identical.
Thanks
Ali M.
function grdItems_DblClick() {
var grid = igtbl_getGridById("ctl00_ContentPlaceHolder1_grdResults"); var row = grid.getActiveRow(); if (row) { var dlg = $find("ctl00_ContentPlaceHolder1_dlgView"); try { if (dlg) { var v = row.getCell(1).getValue(); dlg.get_contentPane().set_contentUrl("ViewonlyRecord.aspx?r=" + v); dlg.show(); } } catch (e) { alert("Error in viewCurrent" + e); } return false; };
<igmisc:WebAsyncRefreshPanel ID="WebAsyncRefreshPanel1" runat="server" Width="100%">
<igtbl:UltraWebGrid ID="grdResults" runat="server" EnableAppStyling="True">
<DisplayLayout .... ClientSideEvents-DblClickHandler="grdItems_DblClick" />
</igtbl:UltraWebGrid>
<ig:WebDialogWindow ID="dlgView" runat="server" ..... >
<ContentPane ContentUrl="about:blank" .../>
</ig:WebDialogWindow>
</igmisc:WebAsyncRefreshPanel>
Hi Ali,
The CallBackManager (used by WebAsyncRefreshPanel and UltraWebTab) is not compatible with AJAX controls. They can not be nested in each other, but they may work within same page only side by side.
You should move dialog out of WARP or use UpdatePanel.
Thanks Viktor for the quick reply...
I was not aware of the incompatibility, so I followed your suggestion but still a postback is occurring. Here is my updated code... Any ideas? Thank you in advance..
function viewCurrent() { var grid = igtbl_getGridById("ctl00_ContentPlaceHolder1_grdResults"); var row = grid.getActiveRow(); if (row) { var dlg = $find("ctl00_ContentPlaceHolder1_dlgView"); dlg.get_contentPane().set_contentUrl("ViewonlyRecord.aspx?r=" + row.getCell(1).getValue()); dlg.show(); } };
<asp:UpdatePanel ID="UpdatePanel1" runat="server" EnableViewState="true" RenderMode="Inline" UpdateMode="Conditional"> <ContentTemplate> <igtbl:UltraWebGrid ID="grdResults" runat="server" Width="950px" EnableViewState="true"> <Bands>...
</Bands> <DisplayLayout AllowColSizingDefault="Free" AllowSortingDefault="Yes" ClientSideEvents-DblClickHandler="viewCurrent" ..... >...
</DisplayLayout> </igtbl:UltraWebGrid>
<ig:WebDialogWindow ID="dlgView" runat="server" Height="750px" Width="950px" WindowState="Hidden" Modal="true" InitialLocation="Centered" Resizer-Enabled="false" CssClass="confirmdialog" ModalBackgroundCssClass="modalbackground"> <Header Visible="true" CaptionText="View Record"></Header> <AutoPostBackFlags Moved="Async" Resized="Async" WindowStateChange="Async" /> <ContentPane ContentUrl="about:blank" FrameScrolling="False" ScrollBars="Hidden" FrameBorder="False"> </ContentPane> </ig:WebDialogWindow>
</ContentTemplate> </asp:UpdatePanel>
Full postback may happen for different reasons. It can be exceptions on client or server. Before doing anything test application without async postbacks (remove UpdatePanel and AutoPostBackFlags) and test if your application will run without exceptions. If it runs correctly, then in order to figure out what is wrong with async postbacks I suggest you to debug by simplifying page. First replace WebDialogWindow by <iframe id="testIframe" src="about.blank"> and instead of dialog.set_contentUrl(value) use$get('testIframe').src=value. For "value" you may use something simpler than"ViewonlyRecord.aspx?r=" + row.getCell(1).getValue(), because that statement along may trigger exception. If it runs use your full address.Next you may disable modal, centered, etc. special features of dialog, replace <iframe> by dialog and test if it works. I do not recommend to use Async for AutoPostBackFlags, especially if dialog is located inside of UpdatePanel, because that feature may confict with architecture of UpdatePanel.