父窗体后台
public void updateView()
{
string str_xuh = CommonStr.Decode(lbxuh.Value);
string str_pxuh = OleDbDB.GetScalarStr("select pxuh from zd_gzzdlbb where xuh='" + str_xuh + "'");
string str_temp = (str_xuh == "" ? " is null" : "='" + str_xuh + "'");
string str_sql = (str_xuh == "" ? "" : ("select " + (str_pxuh == "" ? "null" : str_pxuh) + " xuh,null pxuh,'..' lbmc,'' cjsj,null xzcs,null wjdx,'1' wjlx from dual union all "))
+ "select xuh,pxuh,lbmc,cjsj,null xzcs,null wjdx,'1' wjlx from zd_gzzdlbb where pxuh" + str_temp + " union all"
+ " select xuh,wjlb,wjzt,scsj,xzcs,wjdx,'2' wjlx from zd_gzzdwjb where wjlb" + str_temp; sdsgv.ConnectionString = OleDbDB.ConnString;
sdsgv.SelectCommand = str_sql; gv.DataBind();
}//按钮事件
protected void btnsx_Click(object sender, EventArgs e)
{
updateView();
}
父窗体前台<asp:Button ID="btnsx" runat="server" OnClick="btnsx_Click" Text="Button"/>function showDwlb()
{
shuaxin(window.showModalDialog("zd_dwlb.aspx?str_xuh=" + document.getElementById('<%=lbxuh.ClientID%>').value,window,"dialogWidth:550px;dialogHeight:400px;caption:no;toolbar:no;menubar:no;status:no;help:no;scroll:yes;"));
}
function shuaxin(returnvalue)
{
if(returnvalue == "shuaxin")
{
document.getElementById('<%=btnsx.ClientID%>').click();
}
}
子窗体后台protected void linkbc_Click(object sender, EventArgs e)
{
string str_sql = "";
if (ViewState["str_lb"] != null)
{
//添加
str_sql = "insert into zd_gzzdlbb (xuh,pxuh,lbmc,lbsm,cjsj) values (sequ_zd_gzzdwjb.nextval,'" + ViewState["str_lb"].ToString() + "',?,?,'" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "')";
}
else if (ViewState["str_xuh"] != null)
{ //修改
str_sql = "update zd_gzzdlbb set lbmc=?,lbsm=? where xuh='" + ViewState["str_xuh"] + "'";
} OleDbCommand cmd = new OleDbCommand(str_sql);
cmd.Parameters.Add(new OleDbParameter("lbmc", txt_lbmc.Text));
cmd.Parameters.Add(new OleDbParameter("lbsm", txt_lbms.Text)); if (OleDbDB.ExeSql(cmd) == 1)
{
CommonWeb.RegisterScript("window.returnValue='shuaxin';window.close();");
}
}
子窗体更改数据后 返回"shuaxin"给父窗体,父窗体得到"shuaxin"后,js触发按钮事件,,按扭事件就为了重新绑定gridview所有事件,方法都成功被执行...问题在于 gridview没有刷新....而当手动去点击按钮时,,gridview就刷新了...添加了DataBinding事件...js触发的button.click();执行的DataDind未触发DataBinding事件,而手动点击按钮执行的DataBind方法会触发DataBinding事件区别在于js触发和手动点击按钮触发.......怎么解决呀???
public void updateView()
{
string str_xuh = CommonStr.Decode(lbxuh.Value);
string str_pxuh = OleDbDB.GetScalarStr("select pxuh from zd_gzzdlbb where xuh='" + str_xuh + "'");
string str_temp = (str_xuh == "" ? " is null" : "='" + str_xuh + "'");
string str_sql = (str_xuh == "" ? "" : ("select " + (str_pxuh == "" ? "null" : str_pxuh) + " xuh,null pxuh,'..' lbmc,'' cjsj,null xzcs,null wjdx,'1' wjlx from dual union all "))
+ "select xuh,pxuh,lbmc,cjsj,null xzcs,null wjdx,'1' wjlx from zd_gzzdlbb where pxuh" + str_temp + " union all"
+ " select xuh,wjlb,wjzt,scsj,xzcs,wjdx,'2' wjlx from zd_gzzdwjb where wjlb" + str_temp; sdsgv.ConnectionString = OleDbDB.ConnString;
sdsgv.SelectCommand = str_sql; gv.DataBind();
}//按钮事件
protected void btnsx_Click(object sender, EventArgs e)
{
updateView();
}
父窗体前台<asp:Button ID="btnsx" runat="server" OnClick="btnsx_Click" Text="Button"/>function showDwlb()
{
shuaxin(window.showModalDialog("zd_dwlb.aspx?str_xuh=" + document.getElementById('<%=lbxuh.ClientID%>').value,window,"dialogWidth:550px;dialogHeight:400px;caption:no;toolbar:no;menubar:no;status:no;help:no;scroll:yes;"));
}
function shuaxin(returnvalue)
{
if(returnvalue == "shuaxin")
{
document.getElementById('<%=btnsx.ClientID%>').click();
}
}
子窗体后台protected void linkbc_Click(object sender, EventArgs e)
{
string str_sql = "";
if (ViewState["str_lb"] != null)
{
//添加
str_sql = "insert into zd_gzzdlbb (xuh,pxuh,lbmc,lbsm,cjsj) values (sequ_zd_gzzdwjb.nextval,'" + ViewState["str_lb"].ToString() + "',?,?,'" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "')";
}
else if (ViewState["str_xuh"] != null)
{ //修改
str_sql = "update zd_gzzdlbb set lbmc=?,lbsm=? where xuh='" + ViewState["str_xuh"] + "'";
} OleDbCommand cmd = new OleDbCommand(str_sql);
cmd.Parameters.Add(new OleDbParameter("lbmc", txt_lbmc.Text));
cmd.Parameters.Add(new OleDbParameter("lbsm", txt_lbms.Text)); if (OleDbDB.ExeSql(cmd) == 1)
{
CommonWeb.RegisterScript("window.returnValue='shuaxin';window.close();");
}
}
子窗体更改数据后 返回"shuaxin"给父窗体,父窗体得到"shuaxin"后,js触发按钮事件,,按扭事件就为了重新绑定gridview所有事件,方法都成功被执行...问题在于 gridview没有刷新....而当手动去点击按钮时,,gridview就刷新了...添加了DataBinding事件...js触发的button.click();执行的DataDind未触发DataBinding事件,而手动点击按钮执行的DataBind方法会触发DataBinding事件区别在于js触发和手动点击按钮触发.......怎么解决呀???
{
if(returnvalue == "shuaxin")
{
document.getElementById('<%=btnsx.ClientID%>').click();
}
}
问下楼主这个方法是在哪里调用的?
{
shuaxin(window.showModalDialog("zd_dwlb.aspx?str_xuh=" + document.getElementById('<%=lbxuh.ClientID%>').value,window,"dialogWidth:550px;dialogHeight:400px;caption:no;toolbar:no;menubar:no;status:no;help:no;scroll:yes;"));
}
function shuaxin(returnvalue)
{
if(returnvalue == "shuaxin")
{
document.getElementById('<%=btnsx.ClientID%>').click();
}
}showDwlb这个方法里就调用 了 shuaxin()