62,025
社区成员
发帖
与我相关
我的任务
分享
function open_windows_and_get_customerinfo(openwindow, control, control2) {
var str = window.showModalDialog(openwindow, window, "dialogWidth=500px;dialogHeight=400px;center=yes;help=no;resizable=no;status=no");
if (!str)
return;
document.getElementById(control).value = str[0];
document.getElementById(control2).value = str[1];
}
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#00A9FF'");
//当鼠标移开时还原背景色
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c");
e.Row.Attributes.Add("OnDblClick", "dbclick_return_and_close('" + e.Row.Cells[0].Text + "','" + e.Row.Cells[2].Text + "')");
if (e.Row.Cells[3].Text.Length > 15)
{
e.Row.Cells[3].ToolTip = e.Row.Cells[3].Text;
e.Row.Cells[3].Text = e.Row.Cells[3].Text.Substring(0, 15);
}
if (e.Row.Cells[4].Text.Length > 15)
{
e.Row.Cells[4].ToolTip = e.Row.Cells[4].Text;
e.Row.Cells[4].Text = e.Row.Cells[4].Text.Substring(0, 15);
}
}
}
function dbclick_return_and_close(bomid,bomno)
{
if(bomid!=null&&bomno!=null)
{
var str = new Array(bomid, bomno);
window.returnValue = str;
window.close();
}
}
protected void TextBox1_TextChanged(object sender, EventArgs e)
{
//查询赋值
string sql = "select .xxxx";
this.TextBox2.Text = ReturnDataTable(sql).Rows[0][0].ToString();
//当然用其他方法也可以
}
public static DataTable ReturnDataTable(string cmdtext)
{
SqlConnection cn = new SqlConnection();
cn.ConnectionString = "数据库连接字符串";
DataTable dt = new DataTable();
SqlCommand cmd = new SqlCommand();
cmd = new SqlCommand(cmdtext, cn);
cmd.CommandType = CommandType.Text; ;
SqlDataReader dr = null;
using (dr = cmd.ExecuteReader(CommandBehavior.CloseConnection))
{
dt.Load(dr);
}
return dt;
}