ASP.net中的模式弹出窗口问题 [英] modal PopUp Window in ASP.net Problem

查看:52
本文介绍了ASP.net中的模式弹出窗口问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有Grid视图和Form视图,如果用户单击,我需要显示弹出模式窗口.
Grid View中的编辑"或删除"按钮上,需要触发模式窗口?

i have Grid view and form View and i need to show popup modal windows if user clicked
on edit or delete button in Grid View need to fire the modal window ??
how i can do that?

推荐答案

用户在网格视图"中单击编辑"或删除"按钮需要触发模式窗口
您需要在网格的行级别注入JavaScript.您将需要使用网格的RowDataBound事件,该事件在每个行绑定上触发.在这种情况下,注入JS代码以在单击控件时打开modalpopup.
样本:
user clicked on edit or delete button in Grid View need to fire the modal window
You need to inject JavaScript at row level of the grid. You would need to use RowDataBound event of grid that triggers on every row bind. In this, inject JS code to open the modalpopup on click of a control.
Sample:
//For injecting JS, you need to use RowDataBound of GridView, something like:
protected void GridView_RowDataBound(Object sender, GridViewRowEventArgs e)
{ 
   DataControlRowType rtype = e.Row.RowType;  
   if (rtype == DataControlRowType.DataRow)  
   { 
      // Control specific
      LinkButton l = (LinkButton)e.Row.FindControl("LinkButton1");
      l.Attributes.Add("onclick", "javascript: OpenModalDialogMethodDefinedInJS();"); 
   }
}



请参考:将JavaScript与ASP.Net GridView控件一起使用 [ ^ ]



Refer: Using JavaScript with ASP.Net GridView Control[^]


这篇关于ASP.net中的模式弹出窗口问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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