在Telerik的radgrid控件复选框,单击打开对话窗口 [英] Open dialog window on checkbox click in Telerik RadGrid

查看:248
本文介绍了在Telerik的radgrid控件复选框,单击打开对话窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Telerik的radgrid控件具有GridTemplate列有一个asp:复选框它里面。我选择使用GridTemplate列,而不是GridCheckBoxColumn或ClientSelectColumn,因为我希望用户必须以检查框的能力和复选框,如果它被选中打开一个对话窗口为他们的附件上传到记录点击。我不知道我怎么会去从网格中的复选框,点击打开RadWindow。

I have a Telerik RadGrid with a GridTemplate column that has an asp:CheckBox inside of it. I chose to use a GridTemplate column rather than a GridCheckBoxColumn or ClientSelectColumn because I want the user to have the ability to check the box and on checkbox clicked if it is checked open a dialog window for them to upload attachments to the record. I am not sure how I will go about opening a RadWindow on checkbox click from within a grid.

我试图完成的总体目标是:结果
我有一个网格,看起来像一个清单。如果用户在一排然后检查复选框,这意味着他们将不得不上传一个文档这么一个对话窗口将一个小上传表单打开。一旦他们打保存窗口将关闭,电网将与链接重新绑定到查看下一列附件过来。如果任何人有一个更好的工作流程,我愿意听取建议,否则,就如何做这样的事情,这将是极大的AP preciated任何建议。

The overall goal that I am trying to accomplish is the following:
I have a grid that looks like a checklist. If the user checks the checkbox in a row then that means they will have to upload a document for it so a dialog window will open with a small upload form. Once they hit save the window will close and the grid will rebind with a link to view the attachment in the next column over. If anyone has a better workflow I am open to suggestions, otherwise any advice on how to do something like this would be greatly appreciated.

推荐答案

据有关命令打开RadWindow我也走了类似的方式,提出由马克。没有任何理由使用一个复选框作为一个按钮,因为这是这种控制的功能,你不需要使用它的状态而不是一个命令。

As far as concerning the command to open the RadWindow I would also go in a similar way as proposed by Mark. There is no reason to use a checkbox as a button since this is the function of such control and you do not need to use its status rather then for a command.

添加一个按钮栏,并设置其的CommandName =东西

Add a button column and set its CommandName="something"

在网格和code后面添加这样的事情在里面创建事件itemCommand:

Create the event itemCommand in the grid and in code behind add something like this in it:

if (e.CommandName == "something")
    {

        if (e.Item is RadGridDataItem)
        {  
            RadGridDataItem item = e.Item as RadGridDataItem;
            string script = "function f(){openRadWindow(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);";
            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", script, true);  
        }
    }

添加您的JS:

function openRadWindow() {
        var radwindow = $find('<%=RadWindow1.ClientID %>');
        radwindow.show();
    }

添加您的radWindow:

Add your radWindow:

<telerik:RadWindow ID="RadWindow1" VisibleOnPageLoad="false" OnClientClose="//here you can generate the event to rebind your grid and show the update" runat="server" Width="450px" Height="650px" NavigateUrl="Window1.aspx" >
                    </telerik:RadWindow>

创建页面Window1.aspx,并在那里你的逻辑阐述加载文件。

Create the page Window1.aspx and elaborate in there your logic to load the file.

的另一种方式,更简单,可以是使用用途<一href=\"http://demos.telerik.com/aspnet-ajax/grid/examples/data-editing/form-template-update/defaultcs.aspx\" 而不是相对=nofollow>编辑模板的形式radWindow,并在那里与其他控件一起添加asyncUploader您可能需要从而避免被填充到必须让所有引用到输入关联到纪录。

Another way, easier, could be to use use an edit template form instead of the radWindow and add an asyncUploader in there together with the other controls you may need to be filled in so avoiding to have to get all the references to associate the input to the record.

这篇关于在Telerik的radgrid控件复选框,单击打开对话窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆