看看modalpopupextender点击了什么按钮 [英] see what button was clicked on modalpopupextender

查看:93
本文介绍了看看modalpopupextender点击了什么按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些VB代码。我想看看popupmodelextender点击了什么按钮,我的问题是它没有弹出,所以无法看到按下了什么按钮。



所以我的问题是如何make模式弹出以及如何使用IF语句查看ik确定或取消被按下。



  Dim 成功作为 布尔 =  False  
Dim PTC_ID As 整数
Dim btnDelete As Button = TryCast (发件人,按钮)
Dim 作为 GridViewRow = < span class =code-keyword> DirectCast (btnDelete.NamingContainer,GridViewRow)

Dim cmdDelete 作为 SqlCommand( p_deleteProtocolStructure,MyConnManagement)

PTC_ID = grdQuestions.DataKeys(row.RowIndex).Values( PTC_ID
' - == IF语句查看存储过程是否返回任何内容== - '
Dim sqlString < span class =code-keyword>作为 字符串 = 字符串 .Empty
' SQL CONN'
Dim sqlConnDelProtocol 作为 SqlClient.SqlConnection(ConfigurationManager.ConnectionStri ngs( MyConn)。ConnectionString)
sqlConnDelProtocol.Open()
' DATA ADAPTER'
Dim sqlDataAdapDelProtocol As SqlClient.SqlDataAdapter(sqlString,sqlConnDelProtocol)
sqlDataAdapDelProtocol.SelectCommand.CommandType = CommandType.StoredProcedure
' DATASET'
Dim cmdLinkedProcudures As SqlCommand( p_GetLinkedProcuduresProtocol,sqlConnDelProtocol)
cmdLinkedProcudures.CommandType = CommandType.StoredProcedure
cmdLinkedProcud ures.Parameters.AddWithValue( PTC_ID,PTC_ID)

Dim dsProtocolLinked As DataSet
sqlDataAdapDelProtocol .SelectCommand = cmdLinkedProcudures
sqlDataAdapDelProtocol.Fill(dsProtocolLinked, ProtocolsLinked

如果 dsProtocolLinked.Tables( ProtocolsLinked )。Rows.Count> 0 然后
' < span class =code-comment> - == DELETE PROTOCOL == - '
cmdDelete.CommandType = CommandType.StoredProcedure
cmdDelete.Parameters.AddWithValue( PTC_ID,PTC_ID)
' - == END DELETE PROTOCOL == - '
cmdDelete.Connection = conn
Else
mdlQuestions.Show()' < - 不知道该怎么做
如果 btnPTCOk.OnClientClick 然后 ' < - 不知道该怎么办
cmdDelete.CommandType = C ommandType.StoredProcedure
cmdDelete.Parameters.AddWithValue( PTC_ID,PTC_ID)
结束 如果

结束 如果





我的Ajax和JAvaScript



 function showConfirm(source){
this._source = source;

var ctrl;
ctrl = _source.id;

if(ctrl.indexOf('btnDeletePTS')> 0){
this._popup = $ find('mdlProtocols');
}否则if(ctrl.indexOf('btnDeletePTC')> 0){
this._popup = $ find('mdlQuestions');
}否则if(ctrl.indexOf('imgbtn')> 0){
this._popup = $ find('mdlReorder');
}

if(this._popup){this._popup.show();};

}

函数okClick(){
this._popup.hide();
__doPostBack(this._source.name,'');
}

函数cancelClick(){
//配置popup
this._popup.hide();
this._source = null;
this._popup = null;
}




AJAX

< div id =PTCModalDivrunat =serverstyle = display:none; width:auto; class =modalPopupalign =centernowrap =nowrap>
< img src =../ App_Themes / Main / images / warning.jpgalt =/>您确定要删除此问题吗?< br />
< asp:Button ID =btnPTCOkrunat =serverSkinID =ActionButtonsYesOnClientClick =okClick/>
< asp:Button ID =btnPTCNorunat =serverSkinID =ActionButtonsNoOnClientClick =cancelClick/>
< / div>
< ajaxToolKit:ModalPopupExtender
runat =serverID =mdlQuestionsDropShadow =true
TargetControlID =PTCModalDivPopupControlID =PTCModalDiv
OkControlID =btnPTCOk CancelControlID =btnPTCNoBackgroundCssClass =modalBackground
OnOkScript =okClick()önCancelScript=cancelClick()/>

解决方案
找到( 'mdlProtocols');
}否则if(ctrl.indexOf('btnDeletePTC')> 0){
this._popup =


find('mdlQuestions');
} else if(ctrl.indexOf('imgbtn')> 0){
this._popup =


find('mdlReorder');
}

if(this._popup){this._popup.show();};

}

函数okClick(){
this._popup.hide();
__doPostBack(this._source.name,'');
}

函数cancelClick(){
//配置popup
this._popup.hide();
this._source = null;
this._popup = null;
}




AJAX

< div id =PTCModalDivrunat =serverstyle = display:none; width:auto; class =modalPopupalign =centernowrap =nowrap>
< img src =../ App_Themes / Main / images / warning.jpgalt =/>您确定要删除此问题吗?< br />
< asp:Button ID =btnPTCOkrunat =serverSkinID =ActionButtonsYesOnClientClick =okClick/>
< asp:Button ID =btnPTCNorunat =serverSkinID =ActionButtonsNoOnClientClick =cancelClick/>
< / div>
< ajaxToolKit:ModalPopupExtender
runat =serverID =mdlQuestionsDropShadow =true
TargetControlID =PTCModalDivPopupControlID =PTCModalDiv
OkControlID =btnPTCOk CancelControlID =btnPTCNoBackgroundCssClass =modalBackground
OnOkScript =okClick()önCancelScript=cancelClick()/>


I have some VB code. I want to see what button was clicked on popupmodelextender, my problem is it does not pop up, so cant see what button was pressed.

So my Question is how to make modal pop up and how use an IF statement to see ik OK or cancel was pressed.

Dim success As Boolean = False
        Dim PTC_ID As Integer
        Dim btnDelete As Button = TryCast(sender, Button)
        Dim row As GridViewRow = DirectCast(btnDelete.NamingContainer, GridViewRow)

        Dim cmdDelete As New SqlCommand("p_deleteProtocolStructure", MyConnManagement)

        PTC_ID = grdQuestions.DataKeys(row.RowIndex).Values("PTC_ID")
        '--==IF Statement to see if stored proc returns anything==--'
        Dim sqlString As String = String.Empty
        'SQL CONN'
        Dim sqlConnDelProtocol As New SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings("MyConn").ConnectionString)
        sqlConnDelProtocol.Open()
        'DATA ADAPTER'
        Dim sqlDataAdapDelProtocol As New SqlClient.SqlDataAdapter(sqlString, sqlConnDelProtocol)
        sqlDataAdapDelProtocol.SelectCommand.CommandType = CommandType.StoredProcedure
        'DATASET'
        Dim cmdLinkedProcudures As New SqlCommand("p_GetLinkedProcuduresProtocol", sqlConnDelProtocol)
        cmdLinkedProcudures.CommandType = CommandType.StoredProcedure
        cmdLinkedProcudures.Parameters.AddWithValue("PTC_ID", PTC_ID)

        Dim dsProtocolLinked As New DataSet
        sqlDataAdapDelProtocol.SelectCommand = cmdLinkedProcudures
        sqlDataAdapDelProtocol.Fill(dsProtocolLinked, "ProtocolsLinked")

        If dsProtocolLinked.Tables("ProtocolsLinked").Rows.Count > 0 Then
            '--==DELETE PROTOCOL==--'
            cmdDelete.CommandType = CommandType.StoredProcedure
            cmdDelete.Parameters.AddWithValue("PTC_ID", PTC_ID)
            '--==END DELETE PROTOCOL==--'
            cmdDelete.Connection = conn
        Else
            mdlQuestions.Show()'<--Not sure what to do there
            If btnPTCOk.OnClientClick Then '<--Not sure what to do there
                cmdDelete.CommandType = CommandType.StoredProcedure
                cmdDelete.Parameters.AddWithValue("PTC_ID", PTC_ID)
            End If

        End If



my Ajax and JAvaScript

        function showConfirm(source){
            this._source = source;
            
            var ctrl;
            ctrl=_source.id;
            
            if (ctrl.indexOf('btnDeletePTS')>0) {
                this._popup = $find('mdlProtocols');
            } else if (ctrl.indexOf('btnDeletePTC')>0) {
                this._popup = $find('mdlQuestions');
            } else if (ctrl.indexOf('imgbtn')>0) {
                this._popup = $find('mdlReorder');
            }
            
            if (this._popup) {this._popup.show();};
            
        }
        
        function okClick(){
            this._popup.hide();
            __doPostBack(this._source.name, '');
        }
        
        function cancelClick(){
            //Dispose popup 
            this._popup.hide();
            this._source = null;
            this._popup = null;
        }




AJAX

<div id="PTCModalDiv"  runat="server" style="display:none; width: auto;" class="modalPopup" align="center" nowrap="nowrap">
                                <img src="../App_Themes/Main/images/warning.jpg" alt="" />Are you sure you want to delete this Question?<br />
                                <asp:Button ID="btnPTCOk" runat="server" SkinID="ActionButtonsYes" OnClientClick="okClick" />
                                <asp:Button ID="btnPTCNo" runat="server" SkinID="ActionButtonsNo" OnClientClick="cancelClick" />
                            </div>
                            <ajaxToolKit:ModalPopupExtender 
                                 runat="server" ID="mdlQuestions" DropShadow="true"
                                TargetControlID="PTCModalDiv" PopupControlID="PTCModalDiv" 
                                OkControlID="btnPTCOk" CancelControlID="btnPTCNo" BackgroundCssClass="modalBackground" 
                                OnOkScript="okClick()"  önCancelScript="cancelClick()" />

解决方案

find('mdlProtocols'); } else if (ctrl.indexOf('btnDeletePTC')>0) { this._popup =


find('mdlQuestions'); } else if (ctrl.indexOf('imgbtn')>0) { this._popup =


find('mdlReorder'); } if (this._popup) {this._popup.show();}; } function okClick(){ this._popup.hide(); __doPostBack(this._source.name, ''); } function cancelClick(){ //Dispose popup this._popup.hide(); this._source = null; this._popup = null; } AJAX <div id="PTCModalDiv" runat="server" style="display:none; width: auto;" class="modalPopup" align="center" nowrap="nowrap"> <img src="../App_Themes/Main/images/warning.jpg" alt="" />Are you sure you want to delete this Question?<br /> <asp:Button ID="btnPTCOk" runat="server" SkinID="ActionButtonsYes" OnClientClick="okClick" /> <asp:Button ID="btnPTCNo" runat="server" SkinID="ActionButtonsNo" OnClientClick="cancelClick" /> </div> <ajaxToolKit:ModalPopupExtender runat="server" ID="mdlQuestions" DropShadow="true" TargetControlID="PTCModalDiv" PopupControlID="PTCModalDiv" OkControlID="btnPTCOk" CancelControlID="btnPTCNo" BackgroundCssClass="modalBackground" OnOkScript="okClick()" önCancelScript="cancelClick()" />


这篇关于看看modalpopupextender点击了什么按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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