从控制器MVC打开弹出窗口条件 [英] Open popup conditional from controler MVC

查看:53
本文介绍了从控制器MVC打开弹出窗口条件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

我有一个问题,如果有人可以帮助我会很好。



我希望从我的控制器打开包含数据并向用户提出问题的poup-up。

根据他的回答,我继续或停止治疗。



Hello,
I have a problem and it will be nice if someone can help me.

I want from my controller open a poup-up that contains data and ask a question to the user.
According to his answer, I continue or stop treatment.

Function Traitement(model As TraitementViewModel, confirm_value As String) As ActionResult
        Try
            If (ModelState.IsValid) Then
                Dim exception As Exception = Nothing
                Dim mois As Integer = Mid(model.dateTraitement, 4, 2)
                Dim annee As Integer = Right(model.dateTraitement, 4)
                Session("mois") = mois
                Session("annee") = annee
                Dim extract As Extraction = New Extraction()
              
                Dim result As Integer = extract.Recherche(mois, annee).Rows.Count()
                If (result <> 0) Then
                    OPEN POPUP

                       Artciles    Montant
                            1	    100
                            2	    200

                       Do you want continue

                             YES  NO



                      IF(confirm_value = "yes") Then
                       continue...
                      Else
                       Exit Function
                Else
                    continue...
                End If

              
            End If
        
    End Function





你能帮助我。

非常紧急

非常感谢你。



我尝试过:



[删除重复文本]



Can you help me.
It's very urgent
Thank you very much.

What I have tried:

[Duplicate text removed]

推荐答案

你不能。控制器无法将内容推送到客户端,包括对话框。控制器只能响应客户端请求的数据。



您可以拥有一个由客户端代码调用的控制器操作,并响应一条消息告诉客户端代码显示确认对话框并显示它返回的数据。
You can't. The controller cannot push content to the client, including a dialog. The controller can only respond with data to a client-side request.

You can have a controller action that is called by client-side code and responds with a message that tells the client-side code to display a confirmation dialog and to show the data it returns.


这篇关于从控制器MVC打开弹出窗口条件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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