showModalDialog的刷新问题
<asp:Button ID="btnVerify" runat="server" CssClass="btn2" OnClientClick="return verifyDetail();" Text="确认选择"
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
OnClick="btnVerify_Click" />
<script>
function verifyDetail()//invoked by "确认选择"
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
{
if(varNumber==0)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
alert("请选择核销条目!");
return false;
}
var varCurClass=document.form1.ddlVerifyCurClass[document.form1.ddlVerifyCurClass.selectedIndex].value;//币种
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
var varHidAmount=document.getElementById("hidAmount").value;//隐藏域中的金额
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
// var varSZDW=document.getElementById("hidSZDW").value;//涉帐单位,准备不传这个参数了!①.已改用根据发票id 把
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
inv_main.company_id和pd_company.id两个字段关联,从pd_company中取COMP_C_CNAME字段
// &szdw="+escape(varSZDW)+"//②.传参数时用escape()函数,接受页面(invoice_verify_confirm.aspx)用string wd =
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
Server.UrlDecode(Request.QueryString["szdw"]);则wd为正常汉字
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
var varID=document.getElementById("hidInvoiceId").value;//隐藏域中的已选中项的ID
var varCompID=document.getElementById("hidSZDWID").value;//隐藏域中的已选中项的对应公司的ID
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
// var s = new Object();
// s.name ="aaa";
var win=window.showModalDialog("invoice_verify_confirm.aspx?
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
CurClass="+varCurClass+"&HidAmount="+varHidAmount+"&id="+varID+"&compID="+varCompID+"","","status:Modeless;edge:raised;unador
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
ned:no;scroll=yes;resizable:yes;center=yes;help:no;dialogwidth:890px;dialogheight:425px");
if(win=="ref")
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
// self.location.reload();//如何触发 OnClick="btnSearch_Click"
//alert("aa");
// document.all("btnSearch").click();
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
// document.getElementById("btnSearch").onclick=function()
// {
// alert('a');
// }
//form1.submit();
return true;
}
else
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
return false;
//有这句就不会刷新父窗口,因为不会再执行服务器代码,showModalDialog窗口以右上角“关闭”,以“取消”按钮关闭,都不刷新
}
// if(win.type=="")//传递回的type为空的时候才刷新页面。
// {
// alert("刷新");
// location.reload();
// }
// return ;
// alert("aa");
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
}
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
</script>
protected void btnVerify_Click(object sender, EventArgs e)
{//该函数“顺便”回去服务器把页面上的其他控件“重新”取了回来,实现了“整个”页面的“刷新”
BindData();
}
private void BindData()//从inv_main表中选出已开票记录
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
{
Grid1.Levels[0].Columns.Clear();//在 Grid1.DataBind();执行结束,所有列已Bind over 不能再执行本句,否则会清除所有已经bind 的列
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
string strSql = @"
SELECT
dbo.INV_MAIN.ID,
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
cast(0 as bit) as choice,
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
dbo.INV_MAIN.INV_NO,
dbo.PD_COMPANY.COMP_C_CNAME,
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
dbo.INV_MAIN.CURRENCY,
dbo.INV_MAIN.AMOUNT,
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
cast(dbo.INV_MAIN.AMOUNT_HX as decimal(18,2)) as AMOUNT_HX ,
dbo.INV_MAIN.AMOUNT_WHX,
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
'海运出口' as ywlx,
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
dbo.JOB_SE.JOBNO,
dbo.PD_USER.USER_NAME,
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
convert(varchar(10),DATE_JOB,120) as DATE_JOB,
dbo.JOB_SE.WTBH,
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
dbo.PD_COMPANY.ID as compID
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
FROM dbo.FEE_IN LEFT OUTER JOIN
dbo.PD_USER RIGHT OUTER JOIN
dbo.JOB_SE ON dbo.PD_USER.USER_CODE = dbo.JOB_SE.CR_CODE ON dbo.FEE_IN.PARENTID = dbo.JOB_SE.ID RIGHT OUTER JOIN
dbo.PD_COMPANY RIGHT OUTER JOIN
dbo.INV_MAIN ON dbo.PD_COMPANY.ID = dbo.INV_MAIN.COMPANY_ID ON dbo.FEE_IN.INVOICE_ID = dbo.INV_MAIN.ID where (1=1)";
//dbo.JOB_SE.ETD,需不需要这个字段?dbo.INV_MAIN.DATE_JOB(业务日期)对应job_se中ETD
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
if (ViewState["strSqlBindData"] == null)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
ViewState["strSqlBindData"] = strSql;
}
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
SqlDataAdapter sda = new SqlDataAdapter(strSql, conn);
conn.Open();
DataSet ds = new DataSet();
sda.Fill(ds, "INV_MAIN");
Grid1.DataSource = ds;
Grid1.DataBind();
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
Grid1.Levels[0].Columns["ID"].Visible = false;
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
Grid1.Levels[0].Columns["choice"].HeadingText = "选择";
Grid1.Levels[0].Columns["choice"].ColumnType = GridColumnType.CheckBox;
Grid1.Levels[0].Columns["choice"].Align = ComponentArt.Web.UI.TextAlign.Center;
Grid1.Levels[0].Columns["choice"].Width = 26;
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
Grid1.Levels[0].Columns["INV_NO"].HeadingText = "帐单号";
Grid1.Levels[0].Columns["INV_NO"].Align = ComponentArt.Web.UI.TextAlign.Center;
Grid1.Levels[0].Columns["INV_NO"].Width = 45;
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
Grid1.Levels[0].Columns["COMP_C_CNAME"].HeadingText = "涉帐单位";
Grid1.Levels[0].Columns["COMP_C_CNAME"].Align = ComponentArt.Web.UI.TextAlign.Center;
Grid1.Levels[0].Columns["COMP_C_CNAME"].Width = 56;
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
Grid1.Levels[0].Columns["CURRENCY"].HeadingText = "币种";
Grid1.Levels[0].Columns["CURRENCY"].Align = ComponentArt.Web.UI.TextAlign.Center;
Grid1.Levels[0].Columns["CURRENCY"].Width = 26;
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
Grid1.Levels[0].Columns["AMOUNT"].HeadingText = "帐单金额";
Grid1.Levels[0].Columns["AMOUNT"].Align = ComponentArt.Web.UI.TextAlign.Right;
Grid1.Levels[0].Columns["AMOUNT"].Width =56;
Grid1.Levels[0].Columns["AMOUNT"].FormatString = "N2";
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
Grid1.Levels[0].Columns["AMOUNT_HX"].HeadingText = "已核销";
Grid1.Levels[0].Columns["AMOUNT_HX"].Align = ComponentArt.Web.UI.TextAlign.Right;
Grid1.Levels[0].Columns["AMOUNT_HX"].Width = 45;//
Grid1.Levels[0].Columns["AMOUNT_HX"].FormatString = "N2";
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
Grid1.Levels[0].Columns["AMOUNT_WHX"].HeadingText = "未核销";
Grid1.Levels[0].Columns["AMOUNT_WHX"].Align = ComponentArt.Web.UI.TextAlign.Right;
Grid1.Levels[0].Columns["AMOUNT_WHX"].Width = 45;
Grid1.Levels[0].Columns["AMOUNT_WHX"].FormatString = "N2";//两位小数,每三位有逗号
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
Grid1.Levels[0].Columns["ywlx"].HeadingText = "业务类型";
Grid1.Levels[0].Columns["ywlx"].Align = ComponentArt.Web.UI.TextAlign.Center;
Grid1.Levels[0].Columns["ywlx"].Width = 56;
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
Grid1.Levels[0].Columns["JOBNO"].HeadingText = "工作编号";
Grid1.Levels[0].Columns["JOBNO"].Align = ComponentArt.Web.UI.TextAlign.Center;
Grid1.Levels[0].Columns["JOBNO"].Width = 56;
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
Grid1.Levels[0].Columns["USER_NAME"].HeadingText = "操作人";
Grid1.Levels[0].Columns["USER_NAME"].Align = ComponentArt.Web.UI.TextAlign.Center;
Grid1.Levels[0].Columns["USER_NAME"].Width = 36;
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
Grid1.Levels[0].Columns["DATE_JOB"].HeadingText = "抵离港日";//?dateJOb 还是ETD?dbo.INV_MAIN.DATE_JOB(业务日期)对应job_se中ETD
Grid1.Levels[0].Columns["DATE_JOB"].Align = ComponentArt.Web.UI.TextAlign.Center;
Grid1.Levels[0].Columns["DATE_JOB"].Width = 56;
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
Grid1.Levels[0].Columns["WTBH"].HeadingText = "委托编号";
Grid1.Levels[0].Columns["WTBH"].Align = ComponentArt.Web.UI.TextAlign.Center;
Grid1.Levels[0].Columns["WTBH"].Width = 56;
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
Grid1.Levels[0].Columns["compID"].HeadingText = "涉帐ID";
Grid1.Levels[0].Columns["compID"].Align = ComponentArt.Web.UI.TextAlign.Center;
Grid1.Levels[0].Columns["compID"].Visible = false;
Grid1.Levels[0].Columns["compID"].Width = 56;
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
}