.NET ------ 在新增弹窗中弹出来得弹窗选中赋值到新增页面上
主要是借助隐藏域将选中行的关键字带过来,到后端检索出来赋值给新增的页面上,这时不是保存到表里,要当在新增界面上点保存时才保存到表里
为啥js 不行,因为js 虽然会把值赋值到界面上,但是点击保存时,是不能将显示在界面上的值写到表里的,也是一种保护机制
那个就是通过调用刷新小图片进行刷新操作
<td width="20%" align="right" bgcolor="#F5F5F5">学号(<span style="color :red">*</span>):</td> <td style="white-space: nowrap" align="left" bgcolor="#FFFFFF" width="30%"> <asp:TextBox MaxLength="24" ID="tbStuMark" runat="server" ReadOnly="true"></asp:TextBox> <asp:HiddenField ID="HidStudentGuid" runat="server" /> <a href="javascript:return false;" onclick="javascript:WebDialogLoad('检索', 700, 500, '../Student/Student_order_win.aspx?pwidth=680&pheight=380&c1=<%=tbStuMark.ClientID %>&c2=<%=tbStuName.ClientID %>&c3=<%=HidStudentGuid.ClientID %>&btn=<%=btnRef.ClientID %>&page=xueshengqingjia')" ><img src="../../qdadmin/qdimages/sel.png" align="absmiddle" title="检索"></a> <asp:LinkButton ID="btnRef" runat="server" OnClick="btnRef_Click"><img src="../../qdadmin/qdimages/reset.png" align="absmiddle" title="刷新"></asp:LinkButton> </td>
后面就是进行处理
选择界面:
也可以有多选的
protected void btnSelect_Click(object sender, EventArgs e) { string sGuid = GetSelectString(); if (_sCheckSort == "order") sGuid = GetSelectItems()[0].ToString(); //Student mstudent = bllstudent.GetModelSelStudent3("*", base.EnterpriseGuid, sGuid); if (sGuid.Length < 36) { WebMessageBox1.MessageBox_tishi(700, 300, 200, 300, "请选择学生信息"); } string script = string.Empty; script += "<script language=javascript>"; if (_SourcePage == "classstudent") { string sClassGuid = Request["c1"].ToString(); if (sClassGuid == string.Empty) { WebMessageBox1.MessageBox_tishi(700, 300, 200, 300, "请选择班级后再选择学生"); return; } ITEM.Model.qdMis4.CClass mClass = _bllClass.GetModelSelCClass3("*", base.EnterpriseGuid, sClassGuid); if (mClass == null) { WebMessageBox1.MessageBox_tishi(700, 300, 200, 300, "请选择班级后再选择学生"); return; } List<ITEM.Model.qdMis4.Student> mList = _bllStudent.GetListSelStudent3("*", base.EnterpriseGuid, " and StudentGuid in(" + sGuid + ")"); for (int i = 0; i <= mList.Count - 1; i++) { #region 赋值 ITEM.Model.qdMis4.Student mstu = mList[i]; ITEM.Model.qdMis4.CClass_Student mcstu = new CClass_Student(); //mcstu.StuClassGuid = mstu.StuClassGuid;//学生所在班级关键字 //mcstu.iNumber = mstu.iNumber;//序号 mcstu.QiyeGuid = mstu.QiyeGuid;//云端标识 mcstu.QiyeCode = mstu.QiyeCode;//云端标识 mcstu.QiyeName = mstu.QiyeName;//云端标识 mcstu.DeptGuid = mstu.DeptGuid;//单位关键字 mcstu.DeptCode = mstu.DeptCode;//单位编码 mcstu.DeptName = mstu.DeptName;//单位名称 mcstu.StudentGuid = mstu.StudentGuid;//学生关键字 mcstu.StuMark = mstu.StuMark;//学号 mcstu.StuName = mstu.StuName;//姓名 mcstu.ZhuanYeGuid = mClass.ZhuanYeGuid;//专业名称关键字-增加的权限-总部 mcstu.ZhuanYeName = mClass.ZhuanYeName;//专业名称 mcstu.ClassGuid = mClass.ClassGuid;//班级关键字 mcstu.ClassName = mClass.ClassName;//班级名称 try { mcstu.StudyDateStart = Convert.ToDateTime(this.tbStudyDateStart.Value);//学习开始时间 } catch { WebMessageBox1.MessageBox_tishi(700, 300, 200, 300, "请正确选择学习时间"); return; } try { mcstu.StudyDateEnd = Convert.ToDateTime(this.tbStudyDateEnd.Value);//学习结束时间 } catch { WebMessageBox1.MessageBox_tishi(700, 300, 200, 300, "请正确选择学习时间"); return; } #region 取最大值最小值 { //ITEM.Model.qdMis4.CClass mClassDate = _bllClass.GetModelSelCClass3("ClassDateStart,ClassDateEnd", base.EnterpriseGuid, sClassGuid); string s1 = string.Empty; if (mcstu.StudyDateStart < mClass.ClassDateStart) { mClass.ClassDateStart = mcstu.StudyDateStart; s1 = "ClassDateStart='" + mClass.ClassDateStart.ToString("yyyy-MM-dd") + "'"; } string s2 = string.Empty; if (mcstu.StudyDateEnd > mClass.ClassDateEnd) { mClass.ClassDateEnd = mcstu.StudyDateEnd; s2 = ",ClassDateEnd='" + mClass.ClassDateEnd.ToString("yyyy-MM-dd") + "'"; } string s3 = "^" + s1 + s2 + "^"; s3 = s3.Replace("^,", "").Replace("^", ""); if (s3 != string.Empty) { string strsql = "update tbCClass set " + s3 + " where QiyeGuid='" + base.EnterpriseGuid + "' and ClassGuid='" + sClassGuid + "'"; int kk = _bllClass.SetExByTx(strsql, _XUserLogin.UserLoginGuid, _XUserLogin.UserLoginID, _XUserLogin.UserIP); } } #endregion //mcstu.Remark = mstu.Remark;//备注 mcstu.RowColor = mstu.RowColor;//行颜色 //mcstu.FuJian = mstu.FuJian;//附件 mcstu.Flag = mstu.Flag;//数据标识 mcstu.Flag_Remark = mstu.Flag_Remark;//Flag标识说明,推荐使用枚举 mcstu.OrderBy = 0;//排序编号 mcstu.IsEnabled = 0;//是否禁用0-启用1-禁用 mcstu.IsDelete = 0;//逻辑删除0-正常1-删除 mcstu.CreateUserID = _XUserLogin.UserLoginID;//操作员 mcstu.CreateUserName = _XUserLogin.UserLoginName;//操作员 mcstu.CreateUserGuid = _XUserLogin.UserLoginGuid;//操作员 mcstu.Create_IP = base.GetIp();//录入所属IP地址 mcstu.CreateTime = DateTime.Now;//录入时间 mcstu.UpdateUserID = _XUserLogin.UserLoginID;//操作员 mcstu.UpdateUserName = _XUserLogin.UserLoginName;//操作员 mcstu.UpdateUserGuid = _XUserLogin.UserLoginGuid;//操作员 mcstu.Update_IP = base.GetIp();//修改所属IP地址 mcstu.UpdateTime = DateTime.Now;//操作时间 int k = _bllClassStu.SetAddCClass_Student(mcstu); #endregion } script += "parent.document.getElementById(\"" + _buttonClick + "\").click();"; } else //if(_SourcePage== "xueshengqingjia") { ITEM.Model.qdMis4.Student m = _bllStudent.GetModelSelStudent3("*", base.EnterpriseGuid, sGuid); script += "parent.document.getElementById(\"" + _ctrl1 + "\").value=\"" + m.StuMark + "\";"; script += "parent.document.getElementById(\"" + _ctrl2 + "\").value=\"" + m.StuName + "\";"; script += "parent.document.getElementById(\"" + _ctrl3 + "\").value=\"" + m.StudentGuid + "\";"; script += "parent.document.getElementById(\"" + _buttonClick + "\").click();"; } //方法1 //script += base.GetSrcriptContentByValue(_ctrl1, mstudent.mcstuXXX); //script += base.GetSrcriptContentByValue(_ctrl2, mstudent.mcstuXXX); //script += base.GetSrcriptContentByValue(_ctrl3, mstudent.mcstuXXX); //script += base.GetSrcriptContentByValue(_ctrl4, mstudent.mcstuXXX); //script += base.GetSrcriptContentByValue(_ctrl5, mstudent.mcstuXXX); //script += base.GetSrcriptContentByClick(_buttonClick); //方法2 //script += "parent.document.getElementById(\"" + _ctrl1 + "\").value=\"" + student.mcstuXXX + "\";"; //script += "parent.document.getElementById(\"" + _ctrl1 + "\").value=\"" + student.mcstuXXX + "\";"; //script += "parent.document.getElementById(\"" + _ctrl1 + "\").value=\"" + student.mcstuXXX + "\";"; //script += "parent.document.getElementById(\"" + _ctrl1 + "\").value=\"" + student.mcstuXXX + "\";"; //script += "parent.document.getElementById(\"" + _ctrl1 + "\").value=\"" + student.mcstuXXX + "\";"; //script += "parent.document.getElementById(\"" + _buttonClick + "\").click();"; script += "parent.WebPopupCancel();"; script += "</script>"; ClientScript.RegisterClientScriptBlock(this.GetType(), "WebPopupCancel", script); }
调用刷新的方法进行赋值操作
protected void btnRef_Click(object sender, EventArgs e) { //按钮类型 LinkButton btn = (LinkButton)sender; //获取id if (btn.ID == "btnRef") //学生 { //赋值 string sStudengGuid = this.HidStudentGuid.Value; ITEM.Model.qdMis4.Student mStu = _bllStudent.GetModelSelStudent3("StuMark,StuName,StuQQ,StuWeiXin,StuMobile", base.EnterpriseGuid, sStudengGuid); this.tbStuMark.Text = mStu.StuMark; this.tbStuName.Text = mStu.StuName; this.tbStuQQ.Text = mStu.StuQQ; this.tbStuWeiXin.Text = mStu.StuWeiXin; this.tbStuMobile.Text = mStu.StuMobile; }else //岗位 { string sGongSiGangWeiGuid = this.HidGongSiGangWeiGuid.Value; ITEM.Model.qdMis4.UGongSiGangWei mGw = _bllGongSiGangWei.GetModelSelUGongSiGangWei3("GongSi_Name,GongSi_4001_Name,GongSi_4001_Code,GongSi_Address,GongSi_Tel,GongSi_User,GangWei_Name,GangWei_Content,GangWei_UserSum", base.EnterpriseGuid,sGongSiGangWeiGuid); this.tbGongSi_Name.Text = mGw.GongSi_Name; this.tbGongSi_Tel.Text = mGw.GongSi_Tel; this.tbGongSi_User.Text = mGw.GongSi_User; this.tbGongSi_Address.Text = mGw.GongSi_Address; this.tbGangWei_Name.Text = mGw.GangWei_Name; this.tbGangWei_Content.Text = mGw.GangWei_Content; //if (mGw.GongSi_4001_Code != string.Empty || mGw.GongSi_4001_Code != null) //{ // this.ddlAreaSheng_GongSi_4001_Code.SelectedIndex = int.Parse( mGw.GongSi_4001_Code.Substring(0,17)); // this.ddlAreaShi_GongSi_4001_Code.SelectedIndex = int.Parse(mGw.GongSi_4001_Code.Substring(0, 26)); // this.ddlAreaXian_GongSi_4001_Code.SelectedIndex =int.Parse(mGw.GongSi_4001_Code.Substring(0, 35)); //} //else //{ // this.ddlAreaSheng_GongSi_4001_Code.Text = string.Empty; // this.ddlAreaShi_GongSi_4001_Code.Text = string.Empty; // this.ddlAreaXian_GongSi_4001_Code.Text = string.Empty; //} /* if (mGw.GongSi_4001_Name != string.Empty || mGw.GongSi_4001_Name != null) { string[] ssx = mGw.GongSi_4001_Name.Split('/'); string sheng = ssx[0]; string shi = ssx[1]; string xian = ssx[2]; this.ddlAreaSheng_GongSi_4001_Code.Text = sheng; this.ddlAreaShi_GongSi_4001_Code.Text = shi; this.ddlAreaXian_GongSi_4001_Code.Text = xian; } else { this.ddlAreaSheng_GongSi_4001_Code.Text = string.Empty; } */ } //List<ITEM.Model.qdMis4.CClass_Student> mClassStudentList = _bllClassStudent.GetListSelCClass_Student3("StuClassGuid,ClassName", base.EnterpriseGuid, " and StudentGuid='" + sStudengGuid + "'"); //this.chkClass.DataValueField = "StuClassGuid"; //this.chkClass.DataTextField = "ClassName"; //this.chkClass.DataSource = mClassStudentList; //this.chkClass.DataBind(); //for (int i = 0; i <= this.chkClass.Items.Count - 1; i++) //{ // this.chkClass.Items[i].Selected = true; //} //List<ITEM.Model.qdCnt4.FourCollsType> mTypeList = _bllTypeColls.Get_Ex_FourCollsTypeListByID("TypeCollGuid,TypeCollName", base.EnterpriseGuid, 4303, _XUserLogin.UserLoginOrganizationCode, 0f); //this.chkLesson4303Colls.DataValueField = "TypeCollGuid"; //this.chkLesson4303Colls.DataTextField = "TypeCollName"; //this.chkLesson4303Colls.DataSource = mTypeList; //this.chkLesson4303Colls.DataBind(); //for (int i = 0; i <= this.chkLesson4303Colls.Items.Count - 1; i++) //{ // this.chkLesson4303Colls.Items[i].Selected = true; //} }