Hiding user edit control at start

4 posts, 0 answers
  1. Kenneth Miller
    Kenneth Miller avatar
    5 posts
    Member since:
    Jul 2009

    Posted 11 Oct 2017 Link to this post

    I have a grid component with a user edit ascx control assigned to it. The default behavior, apparently, is for that edit control to be visible when the grid is first loaded/displayed. I do not want it visible. How do I go about hiding it at startup?

     

    Here is the ending section of my radgrid definition. Is there something I can do in here to hide that form?

                    </Columns>
                    <CommandItemSettings ShowAddNewRecordButton="false" />
                    <EditFormSettings  UserControlName="DiscountEditor.ascx" EditFormType="WebUserControl" >
                        <EditColumn UniqueName="EditCommandColumn1">
                        </EditColumn>
                    </EditFormSettings>
                </MasterTableView>
                <ClientSettings>
                    <ClientEvents OnRowDblClick="RowDblClick" OnPopUpShowing="onPopUpShowing" />
                </ClientSettings>
            </telerik:RadGrid>

  2. Rumen
    Admin
    Rumen avatar
    14029 posts

    Posted 16 Oct 2017 Link to this post

    Hi Kenneth,

    Actually the default behavior is the opposite one - the edit form is not displayed until the user presses the pencil icon/edit button.

    Your scenario looks similar to the one shown by the Edit Form Types demo, where the edit form of the second grid row is made editable on page load via the following code:

    DefaultCS.aspx.cs
    protected void RadGrid1_PreRender(object sender, System.EventArgs e)
    {
        if (!this.IsPostBack && this.RadGrid1.MasterTableView.Items.Count > 1)
        {
            this.RadGrid1.MasterTableView.Items[1].Edit = true;
            this.RadGrid1.MasterTableView.Rebind();
        }
    }

    If you comment out the highlighted row the grid will be rendered as shown in this video: https://www.screencast.com/t/IFTBJHxEb.

    You can find more details in the following articles:
    Custom Edit Forms
    ReadOnly Option for WebUserControl Edit Form 


    Best regards,
    Rumen
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  3. Kenneth Miller
    Kenneth Miller avatar
    5 posts
    Member since:
    Jul 2009

    Posted 16 Oct 2017 in reply to Rumen Link to this post

    Thank you. That does appear to have cleared it up. I had this in my PreRender call:

     

        Protected Sub RadGrid1_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadGrid1.PreRender
            If Not IsPostBack And Me.RadGrid1.MasterTableView.Items.Count > 1 Then
                'Me.RadGrid1.MasterTableView.Items(1).Edit = True
                Me.RadGrid1.MasterTableView.Rebind()
            End If
        End Sub

     

    One further question: can you point me toward some example for controlling the position of the user control when it appears?

  4. Rumen
    Admin
    Rumen avatar
    14029 posts

    Posted 16 Oct 2017 Link to this post

    Hi,

    You can control the position of the UserControl contents via CSS as you would do for every standard HTML element(s). Here is a short video demo: https://www.screencast.com/t/JCrpuRspqr


    Best regards,
    Rumen
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top