日期:2014-05-19  浏览次数:20484 次

高手又来抢分了
我想做二件事:
1.在GridView中的任意行位置插入一空行作输入。
2.在有日期的字段边设计一个小图,点击后出现大的日期控件,选取日期输入。
请高手指点!
不要教我上谷歌、百度,那上面没有,我查过了。

------解决方案--------------------
第二個可以用第三方控件。NetAdvantage很好用,
------解决方案--------------------
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.Header) { GridViewRow row = new GridViewRow(0, 0, DataControlRowType.DataRow, DataControlRowState.Normal); for (int i = 0; i < e.Row.Cells.Count; i++) { row.Cells.Add(new TableCell()); } TextBox txt = new TextBox(); txt.ID = "t1 "; row.Cells[0].Controls.Add(txt); this.GridView1.Controls[0].Controls.Add(row); } } 搜索一下梅花雨的日历控件.
------解决方案--------------------
慕白的代码都给出来了,第一个问题你自己就可以解决,思考下就能写出来
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if ((e.Row.RowType == DataControlRowType.DataRow)&&(e.Row.RowIndex == yoursetting))
{
GridViewRow row = new GridViewRow(0, 0, DataControlRowType.DataRow, DataControlRowState.Normal);
for (int i = 0; i < e.Row.Cells.Count; i++)
{
row.Cells.Add(new TableCell());
}
TextBox txt = new TextBox();
txt.ID = "t1 ";
txt.Text = e.row.cells[2].Text;
row.Cells[0].Controls.Add(txt);
this.GridView1.Controls[0].Controls.AddAt(yoursetting,row);
}
}