我可以从asp.net gridview编辑点击进行模态对话吗?

时间:2022-07-07 11:17:13

I am wondering if it is possible to have a modal dialog (like JQuery) by clicking Edit button on a asp.net built in gridview control. If yes, can anymore point me out the brief process of how it could be done. Please see the picture below for clarification.

我想知道是否可以通过在gridview控件内置的asp.net上单击编辑按钮来获得模态对话框(如JQuery)。如果是的话,我可以再指出如何完成它的简短过程。请参阅下面的图片以获得澄清。

Thanks.

谢谢。

我可以从asp.net gridview编辑点击进行模态对话吗?

1 个解决方案

#1


1  

I see few ways to do that:

我认为没有办法做到这一点:

Using OnEditCommand property (assuming you are using <asp:EditCommandColumn to draw that edit link): You can show popup using serverside handler (for instance, popup included into ajaxcontroltoolkit.dll which allows to show popup from serverside easily on page reload)

使用OnEditCommand属性(假设您使用 :editcommandcolumn绘制该编辑链接):您可以使用serverside处理程序显示弹出窗口(例如,弹出窗口包含在ajaxcontroltoolkit.dll中,允许在页面重新加载时轻松地从服务器端显示弹出窗口)

Another option: Make your own column with edit link for each item. It can have OnClientClick handler which will open jQuery popup directly on client (but you will need to get row info for current line from server somehow: with your own ajax call or, suppose it will be better, using webservice with webmethod)

另一个选项:使用每个项目的编辑链接创建自己的列。它可以有OnClientClick处理程序,它将直接在客户端上打开jQuery popup(但是你需要从服务器获取当前行的行信息:使用你自己的ajax调用,或者假设它会更好,使用带webmethod的webservice)

Second option could be modified: instead of creating own column, you may add click even handler with that same jquery on default edit link with return false, so it will prevent form submition.

可以修改第二个选项:您可以在默认编辑链接上添加具有相同jquery的click even处理程序而不是创建自己的列,并返回false,因此它将阻止表单子目录。

I never did something like this personally and even newer saw implementations of such thing, but I would select some option from those listed above. I do not think that there is some really simply, built in way of doing that.

我从来没有亲自做过这样的事情,甚至更新看到了这样的事情的实现,但我会从上面列出的那些中选择一些选项。我不认为有一些非常简单,内置的方式。

UPD: Here is an example of opening popup with own edit button and modalpopupextender from ajax control toolkit (similar like in my first option except that they are using own edit button, which I think could be easily replaced by default one and OnEditCommand even handler) : http://www.c-sharpcorner.com/UploadFile/krishnasarala/edit-gridview-row-with-model-popup-extender-in-Asp-Net-ajax/

UPD:这是一个用ajax控件工具包打开带有自己的编辑按钮和modalpopupextender的弹出窗口的示例(类似于我的第一个选项,除了他们使用自己的编辑按钮,我认为可以很容易地替换为默认的一个和OnEditCommand甚至处理程序) :http://www.c-sharpcorner.com/UploadFile/krishnasarala/edit-gridview-row-with-model-popup-extender-in-Asp-Net-ajax/

#1


1  

I see few ways to do that:

我认为没有办法做到这一点:

Using OnEditCommand property (assuming you are using <asp:EditCommandColumn to draw that edit link): You can show popup using serverside handler (for instance, popup included into ajaxcontroltoolkit.dll which allows to show popup from serverside easily on page reload)

使用OnEditCommand属性(假设您使用 :editcommandcolumn绘制该编辑链接):您可以使用serverside处理程序显示弹出窗口(例如,弹出窗口包含在ajaxcontroltoolkit.dll中,允许在页面重新加载时轻松地从服务器端显示弹出窗口)

Another option: Make your own column with edit link for each item. It can have OnClientClick handler which will open jQuery popup directly on client (but you will need to get row info for current line from server somehow: with your own ajax call or, suppose it will be better, using webservice with webmethod)

另一个选项:使用每个项目的编辑链接创建自己的列。它可以有OnClientClick处理程序,它将直接在客户端上打开jQuery popup(但是你需要从服务器获取当前行的行信息:使用你自己的ajax调用,或者假设它会更好,使用带webmethod的webservice)

Second option could be modified: instead of creating own column, you may add click even handler with that same jquery on default edit link with return false, so it will prevent form submition.

可以修改第二个选项:您可以在默认编辑链接上添加具有相同jquery的click even处理程序而不是创建自己的列,并返回false,因此它将阻止表单子目录。

I never did something like this personally and even newer saw implementations of such thing, but I would select some option from those listed above. I do not think that there is some really simply, built in way of doing that.

我从来没有亲自做过这样的事情,甚至更新看到了这样的事情的实现,但我会从上面列出的那些中选择一些选项。我不认为有一些非常简单,内置的方式。

UPD: Here is an example of opening popup with own edit button and modalpopupextender from ajax control toolkit (similar like in my first option except that they are using own edit button, which I think could be easily replaced by default one and OnEditCommand even handler) : http://www.c-sharpcorner.com/UploadFile/krishnasarala/edit-gridview-row-with-model-popup-extender-in-Asp-Net-ajax/

UPD:这是一个用ajax控件工具包打开带有自己的编辑按钮和modalpopupextender的弹出窗口的示例(类似于我的第一个选项,除了他们使用自己的编辑按钮,我认为可以很容易地替换为默认的一个和OnEditCommand甚至处理程序) :http://www.c-sharpcorner.com/UploadFile/krishnasarala/edit-gridview-row-with-model-popup-extender-in-Asp-Net-ajax/