ListView and Window problem

6 posts, 0 answers
  1. Geoff
    Geoff avatar
    28 posts
    Member since:
    Jul 2010

    Posted 30 Jun 2012 Link to this post

    Hi All

    I am in the process of developing some functionality that uses the RadList and RadWindow.

    The requirement is....

    When an item is selected in the List control I need to open a RadWindow to display and edit the selected record.

    Once editing completed close the Window and then the List control to be refreshed...

    Anyone have any pointers on how to achieve this?

    Any help greatly apprecaited.

    Thanks

  2. Eyup
    Admin
    Eyup avatar
    3015 posts

    Posted 04 Jul 2012 Link to this post

    Hello Geoff,

    I am afraid the requested feature is not applicable out of the box as opposed to in-line editing demonstrated in the following demo:
     ListView / Declarative definition

    You could check out the following demos where the requested functionality is achieved with RadGrid and RadWindow used as the container of the edit form items:
     RadWindow as controls container
     Window / Use as controls container
     Window / Edit Dialog for RadGrid


    Additionally, you could refer to the articles below to get a better understanding of the Client side API of RadWindow and submitting value from the opened window:
     RadWindow Client-Side API
     Window / Returning Values from a Dialog

    I hope this will prove helpful.

    Regards,
    Eyup
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Ivo
    Ivo avatar
    8 posts
    Member since:
    Nov 2012

    Posted 24 May 2013 Link to this post

    Hi Geoff I'm having the same problem.. I'm new to telerik and multiple solutions confuses me. How did you solve it? did you use radgrid?
  5. Eyup
    Admin
    Eyup avatar
    3015 posts

    Posted 28 May 2013 Link to this post

    Hi Jorge,

    Can you share your desired scenario and functionality?

    Regards,
    Eyup
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  6. Ivo
    Ivo avatar
    8 posts
    Member since:
    Nov 2012

    Posted 20 Jun 2013 Link to this post

    Hi

    I've a RadListView where I present a list of shortcuts (i.e. links to websites), and each item has an edit and delete buttons. When the user clicks on the edit button, a RadWindow appears where he can edit the url and title of the shortcut (and when he clicks on the delete button a RadConfirm appears before the system deletes it).

    I've already managed to do it: I adapted the RadGrid edit item demo(http://demos.telerik.com/aspnet-ajax/controls/examples/integration/gridandwindow/defaultcs.aspx?product=window). And for the delete button I followed the window confirm dialog integration demo.(http://demos.telerik.com/aspnet-ajax/window/examples/confirmserverclicks/defaultcs.aspx).

    Here is the core of what I've done:

    JS:
    function openEditWindow(shrt) {
            window.radopen("UserControls/Shortcuts/EditShortcut.aspx?shortcut=" + shrt, "RadWindow_AddEdit");
            return false;
        }
     
    function openAddWindow() {
            window.radopen("UserControls/Shortcuts/EditShortcut.aspx", "RadWindow_AddEdit");
            return false;
        }
     
        function confirmDelete(button) {
            function linkButtonCallbackFn(args) {
                if (args) {
                    eval(button.href);
                }
            }
            radconfirm("Are you sure you want to delete this shortcut?", linkButtonCallbackFn, 330, 180, null, "Confirm");
        }

    ASCX:
    <telerik:RadListView ID="RadListView_Shortcuts" runat="server" ... >
                <LayoutTemplate>
                    ...
                            <a href="#" onclick="return openAddWindow();">+ Add New Shortcut</a>
                    ...
                </LayoutTemplate> 
    <ItemTemplate>
                    <tr runat="server" id="row" class="rlvI" >
                        <td>
                            <asp:Label ID="tNameLabel" runat="server"  Text='<%# Eval("shortcut_ID") %>' Visible="false"/>
                            <asp:HyperLink ID="Hyperlink_ShortcutData" runat="server" NavigateUrl='<%# Eval("shortcut_URL") %>' Text='<%# Eval("shortcut_Name") %>' Target="_new" CssClass="shortcutsItem"></asp:HyperLink>
                        </td>
                        <td>
                            <asp:LinkButton ID="LinkButton_Edit" runat="server" Text="Edit"  OnClientClick='<%# Eval("shortcut_ID", "openEditWindow({0});return false;")  %>' CssClass="shortcutsButton" />
                        </td>
                        <td>
                            <asp:LinkButton ID="LinkButton_Delete" runat="server" Text="Delete" CommandArgument='<%# Eval("shortcut_ID") %>' OnClick="LinkButtonDelete_Click" OnClientClick="confirmDelete(this); return false;" CssClass="shortcutsButton" />
                        </td>
                    </tr>
                </ItemTemplate>
    <EmptyDataTemplate>
    ...
                            <a href="#" onclick="return openAddWindow();">+ Add New Shortcut</a>
    ...
                </EmptyDataTemplate>
     
    C#: (for the delete)
            protected void LinkButtonDelete_Click(object sender, EventArgs e)
            {
                var btn = (LinkButton)sender;
                int shrt = Convert.ToInt32(btn.CommandArgument);
                GetDataTable("[dbo].DeleteShortcutByShortcutID", "@shortcut", shrt);
                Response.Redirect(Request.RawUrl);
     
            }

  7. Eyup
    Admin
    Eyup avatar
    3015 posts

    Posted 25 Jun 2013 Link to this post

    Hi Jorge,

    I am glad that you are sharing your solution. I hope that it will prove helpful to other developers, too.
    Please let us know if any issues arise.

    Regards,
    Eyup
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017