C Sharp Ajax模态弹出式扩展器 [英] C sharp ajax modal popup extender

查看:51
本文介绍了C Sharp Ajax模态弹出式扩展器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在asp.net网站上工作.
向用户提供了一个删除按钮.当用户单击删除按钮时,我想从数据库中获取一些数据,如果数据库返回的记录数大于0,则需要向用户显示一个弹出窗口,该弹出窗口将具有从数据库中获取的记录名称,并且不应允许用户删除.
我知道如何直接在asp.net页面上的Ajax中创建弹出窗口,但不知道在代码中检查某些条件后如何创建弹出窗口.

有人可以告诉我该怎么做.

i m working on asp.net website.
One delete button is provided to user. When user clicks delete button,I want to fetch some data from database and if number of records returned by database greater than 0 then need to show a popup to user which will have names of records fetched from database and user should not be allowed to delete .
i know how to create popup in ajax directly on asp.net page but dont know how to create popup when some condition is checked in code.

Can someone tell me how to do so.
do i need to use client script and if so how?

推荐答案

如果我正确理解了您的问题,那非常简单!试试这个:

If I understood your question correctly its very simple! try this:

int i=command.ExecuteNonQuery();

if(i>0)
{

//your showpop code goes here 

}



希望对您有所帮助:)

有关更多查询,请在此处评论!



hope it helps :)

for further queries comment here!


是的,您必须使用javascript..
像这样声明您的ModalPopupExtender.行为ID很重要.

yes you have to go for javascript..
declare your ModalPopupExtender like this. Behaviour ID is important.

<cc1:modalpopupextender id="id"  runat="server"
       PopupControlID="panel1"
       BackgroundCssClass="modalBackground"
       DropShadow="true"
      OkControlID="BacktoForm"
       BehaviorID="MPE" <!-- Added behavior to the control and named it the same as the ID-->

     /></cc1:modalpopupextender>



稍后在单击按钮时执行代码.准备要显示的面板.

然后调用下面的javascript函数..



later do your code on button click. prepare the panel ready for display.

then call the below javascript function..

function showpopup()
{


find(' MPE').show() ; }
find('MPE').show(); }



希望它能工作..



hope it works..


这篇关于C Sharp Ajax模态弹出式扩展器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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