日期:2014-05-18 浏览次数:20423 次
function CloseWindow() { var value=XXXX; window.returnValue =value; window.close(); .... }
------解决方案--------------------
並寫回一個或兩個值給gridview中的某文本框
==========
谁在玩文字游戏? 请告诉大家哪个文本框?同一行?
------解决方案--------------------
偶不是高手...或者你可以这样(偶没有试过,根据别的代码改的)
使用客户端代码
//定位单元格,其实就是一个TD... var GridView = document.getElementById(/*你的GridView的ClientID*/strGvId); var cell= GridView.rows[rowIdx].cells[cellInx]; //然后你可以随便操作你可爱的单元格了,例如直接cell.innerHTML = "1234";
------解决方案--------------------
// 参考一下 DEMO
<%@ Page Language="C#" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Text" %>
<%--http://topic.csdn.net/u/20080702/19/84d63cac-25e2-45ba-b1cf-4b7330d8da7d.html?seed=257326723--%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
void ShowStudentData()
{
DataTable dt = CreateSampleData();
GridView1.DataSource = dt;
GridView1.DataBind();
}
#region sample data
static DataTable CreateSampleEmptyDataTable()
{
DataTable tbl = new DataTable("Student");
tbl.Columns.Add("StudentNO", typeof(string));
tbl.Columns.Add("FirstName", typeof(string));
tbl.Columns.Add("LastName", typeof(string));
tbl.Columns.Add("Age", typeof(int));
tbl.Columns.Add("Gender", typeof(string));
return tbl;
}
static DataTable CreateSampleData()
{
DataTable tbl = CreateSampleEmptyDataTable();
tbl.Rows.Add("20021342", "Jack", "Wu", 25, "M");
tbl.Rows.Add("20025341", "Jue", "You", 23, "F");
tbl.Rows.Add("20022254", "Viky", "Huang", 24, "F");
tbl.Rows.Add("20022231", "Leo", "Wong", 24, "M");
return tbl;
}
#endregion
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
ShowStudentData();
}
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>GridView</title>
<script type="text/javascript">
function SomeAction(rowId)
{
// var retVal = window.showModalDialog(location.href);
// 如何对同一行的控件进行操作
document.getElementById(rowId + "_TextBox1").value =