protected void ASPxGridView_yh_RowCommand(object sender, ASPxGridViewRowCommandEventArgs e)
{
//获取ID
int id = Convert.ToInt32(e.KeyValue.ToString());
//显示弹窗
PopupWindow pcwindow = new PopupWindow();
pcwindow.ShowOnPageLoad = true;//这个必须有
DevExpress.Web.ASPxButton btn = e.CommandSource as ASPxButton;
if (btn == null)
{
return;
}
if (btn.CommandName == "cn_mmhf")//密码恢复
{
var cx_yh = from aa in sjklj.tb_yh
where aa.ID == id
select aa;
if (cx_yh.Count() > 0)
{
string yhm = cx_yh.First().yhm;
string mm = cx_yh.First().mm;
string xxmc = cx_yh.First().xxmc;
string mmmw = gj.Decrypt(mm, webncxk_class.hq_salt(), webncxk_class.hq_jmmy());
if (mmmw != "123")
{
//恢复为123
cx_yh.First().mm = webncxk_class.Encrypt("123", webncxk_class.hq_salt(), webncxk_class.hq_jmmy());
sjklj.SaveChanges();
//释放资源
if (sjklj.Connection.State == ConnectionState.Open)
{
sjklj.Connection.Close();
}
}
else
{
// pcwindow.Modal = true;
pcwindow.Text = xxmc + "的用户" + yhm + ",你的密码是123或者恢复为123了,为了提高登录安全性,建议修改初始密码。";
this.ASPxPopupControl1.Windows.Add(pcwindow);
return;
}
}
}
//试用体验
if (btn.CommandName == "cn_syty")//测试并利用弹窗弹出自动控件id
{
/* 成功
* PopupWindow pcwindow = new PopupWindow();
pcwindow.ShowOnPageLoad = true;//这个必须有
//pcwindow.Controls.Add(this.ASPxPanel1);
//this.ASPxPopupControl1.Windows.Add(pcwindow);
//this.ASPxPanel1.Visible = true;//成功,极品。还要测试this.ASPxPanel1中加入按钮,单击按钮能否执行事件,例如在该面板中的标签上显示文本;还要测试pcwindow加载网址
*/
/* 这个也成功了,极品。打开新的页面
pcwindow.ContentUrl = "~/default.aspx";
//pcwindow.ContentUrlIFrameTitle = "首页";
this.ASPxPopupControl1.Windows.Add(pcwindow);
*/
pcwindow.Controls.Add(this.ASPxPanel1);//this.ASPxPanel1在aspx页面设计中设置visible=false
this.ASPxPopupControl1.Windows.Add(pcwindow);
this.ASPxPanel1.Visible = true;
return;
}
}
|