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

ListView and Window problem

5 Answers 87 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Geoff
Top achievements
Rank 1
Geoff asked on 30 Jun 2012, 03:00 PM
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

5 Answers, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 04 Jul 2012, 01:48 PM
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.
0
Ivo
Top achievements
Rank 1
answered on 24 May 2013, 04:13 PM
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?
0
Eyup
Telerik team
answered on 28 May 2013, 11:37 AM
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.
0
Ivo
Top achievements
Rank 1
answered on 20 Jun 2013, 01:06 PM
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);
 
        }

0
Eyup
Telerik team
answered on 25 Jun 2013, 06:48 AM
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.
Tags
ListView
Asked by
Geoff
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Ivo
Top achievements
Rank 1
Share this question
or