This is a migrated thread and some comments may be shown as answers.

UserControl Popup Updates

6 Answers 296 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Servando
Top achievements
Rank 1
Servando asked on 19 Feb 2009, 05:50 PM
I've a RadGrid with EditFormType="WebUserControl" EditMode="PopUp" PopUpSettings-Modal="true".
UserControl initialization is done on the Page_Load event, under (_dataItem != null) condition, and instantiation under (_dataItem is IXPathNavigable) condition (DataSource is an XMLDataSource).

Further initialization of the userControl (some behavior params) is done on the RadGrid_ItemCreated event, when (e.Item is GridEditFormItem && e.Item.IsInEditMode && e.Item.DataItem != null).

The problem is that althougth PopUpSettings are Modal focus goes away of the popup (it doesn't happen on a Modal RadWindow, but only on RadGrid edition Popup)... It'd be a minor drawback (I've noted also that the Popup width is smaller than the declared width, so a 100% width draws a little content outside) but I haven't been able to set focus to the first control inside the UserControl.

May be one way to do that is through the PopUpShowing RadGrid client event, but the event is declared on the RadGrid page and I've not found a way to name a Control inside the UserControl of the Popup.

Moreover, there is an other problem with the modal popup: position isn't preserved between the UserControl postbacks.

As the UserControl does some "on change" computing I use the technique described on mantain focus between postbacks (adapted as mine works inside a UserControl), but of course I've unpplugged this hack when testing proves to avoid any lateral effect.



I've finally set focus on first control, setting its ClientID into the __LASTFOCUS hidden field described on the document mantain focus between postbacks, although focus still goes away to the disabled  (cause of Modal mode) controls of the page using the TAB key. But I still don't know how to preserve popup position between postbacks.

There is an other problem also: a mose over disabled controls of the UserControl PopUp cause a javascript error even when code has no javascript event programmed.

6 Answers, 1 is accepted

Sort by
0
Sebastian
Telerik team
answered on 24 Feb 2009, 10:37 AM
Hello Servando,

How use the Modal mode of the built-in popup edit form of RadGrid for ASP.NET AJAX you can see from the following online demo of the product (the first grid):

http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/popupeditform/defaultcs.aspx

Note that the same logic should work as expected when you use WebUserControl or FormTemplate custom edit form. Also verify that you are using the latest version 2008.3.1314 of the suite.

How to focus an editor which resides in the grid edit form you can see from the following topic in the documentation.

To change the position of the popup edit form in par with your preferences, consider the solution explained in this article as a starting point.

Finally, the error you receive when hovering disabled elements has been reported to Microsoft already and appears to be an issue with the ASP.NET AJAX framework in general. Please visit the thread in the public ASP.NET AJAX forums linked below and consider the workarounds discussed there:

http://forums.asp.net/t/1151199.aspx

Kind regards,
Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Servando
Top achievements
Rank 1
answered on 25 Feb 2009, 11:58 AM

Thank you for your answers; I know the articles about popup edit form and for setting position of the popup, but the problem about later is that it sets popup position also on UserControl postbacks (well, it needs to set width in "px", and I had used "em"). Is there any way to avoid "reseting" the popup position on the UserControl postbacks?.

 

To set focus on the popup I didn't try the OnItemDataBound event as is clearly explained on the article "focus the textboxes..."; thank you for the reference.

 

I saw Microsoft ASP.NET AJAX framework bug reported on the forum, but I'm surprised as it seems to be still an open issue since 2007... I hope it've been solved on version .NET.3.5 as I'm still using .Ajax.1.0.

0
Sebastian
Telerik team
answered on 25 Feb 2009, 12:15 PM
Hello Servando,

Unfortunately it is not possible to avoid reseting the popup edit form position when initiating postback from within the user control edit form. I hope this is not a major show stopper for you and you may consider disabling the popup relocation with your custom code to avoid the unwanted effect.

Kind regards,
Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Servando
Top achievements
Rank 1
answered on 25 Feb 2009, 12:24 PM
How can I avoid user relocation of the popup?
0
Accepted
Sebastian
Telerik team
answered on 03 Mar 2009, 03:17 PM
Hello Servando,

To prevent the relocation of the RadGrid built-in popup edit form, you merely need to assign an empty function to the _popUpMouseDown prototype as follows:

            <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">  
                <AjaxSettings> 
                    <telerik:AjaxSetting AjaxControlID="RadGrid1">  
                        <UpdatedControls> 
                            <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" /> 
                        </UpdatedControls> 
                    </telerik:AjaxSetting> 
                </AjaxSettings> 
            </telerik:RadAjaxManager> 
            <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Height="75px" 
                Width="75px" Transparency="25">  
                <img alt="Loading..." src='<%= RadAjaxLoadingPanel.GetWebResourceUrl(Page, "Telerik.Web.UI.Skins.Default.Ajax.loading2.gif") %>' 
                    style="border: 0px;" /> 
            </telerik:RadAjaxLoadingPanel> 
            <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">  
            <script type="text/javascript">  
              Telerik.Web.UI.RadGrid.prototype._popUpMouseDown = function ()   
              {  
                
              }  
            </script> 
            </telerik:RadCodeBlock> 
            <telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="SqlDataSource1" AllowSorting="True" 
                Skin="Office2007" ShowStatusBar="true" GridLines="None" Width="95%">  
                <MasterTableView Width="100%" AllowMultiColumnSorting="true" EditMode="PopUp">  
                  <Columns> 
                    <telerik:GridEditCommandColumn /> 
                  </Columns> 
                </MasterTableView> 
            </telerik:RadGrid> 
            <br /> 
            <asp:SqlDataSource ID="SqlDataSource1" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>" 
                ProviderName="System.Data.SqlClient" SelectCommand="SELECT TOP 10 CustomerID, CompanyName, ContactName, ContactTitle, Address, PostalCode FROM Customers" 
                runat="server"></asp:SqlDataSource> 
 
Greetings,
Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Servando
Top achievements
Rank 1
answered on 04 Mar 2009, 06:02 PM
Thanks
Tags
Grid
Asked by
Servando
Top achievements
Rank 1
Answers by
Sebastian
Telerik team
Servando
Top achievements
Rank 1
Share this question
or