private void gv01_RowCommand(object sender,GridViewCommandEventArgs e)
{
int rowIndex=-1;
GridViewRow row=null;
if(e.CommandName=="Update")
{
rowIndex = Convert.ToInt32(e.CommandArgument);
row = gv01.Rows[rowIndex];
LinkButton btn=(LinkButton)row.Cells[3].Controls[0];
btn.Attributes.Add("onclick","return confirm('確定要更新此筆附件嗎?')");
//怎样当e.CommandName=="Update"时加上客户端事件?上面的代码不行啊
}
}谢谢
{
int rowIndex=-1;
GridViewRow row=null;
if(e.CommandName=="Update")
{
rowIndex = Convert.ToInt32(e.CommandArgument);
row = gv01.Rows[rowIndex];
LinkButton btn=(LinkButton)row.Cells[3].Controls[0];
btn.Attributes.Add("onclick","return confirm('確定要更新此筆附件嗎?')");
//怎样当e.CommandName=="Update"时加上客户端事件?上面的代码不行啊
}
}谢谢
解决方案 »
- 方法赋值的访问题
- 未将对象引用设置到对象的实例。(不好意思,刚刚发错了)
- 很抱歉没分了,关于VS2005取控件问题,解决马上结贴
- 自动留言的程序
- //我有login.aspx(登录页面)main.aspx.....(多个页面)如何保证在未在login.aspx页面成功登录的情况下,输入其他页面的url时,自动转到l
- asp.net 新闻采集系统实现原理
- .cs里的代码如何获得Html的ListBox控件中的值?(我已查过以前的帖子,但是无法解决)
- 二维数组的合并问题
- 求助:新手下载了源码,在VS里怎么调试?
- ashx 怎样获取GET方式发来的Json数据
- 100分 asp.net utf-8 中文参数 (直接在地址栏输入网址)
- frame框架,限制拉伸大小的问题
Put your the code (in blue color) to RowDataBound event
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if(e.Row.RowType == DataControlRowType.DataRow)
{
//你的代码
}
}
谢谢
{
string script="if document.getElementById('').size<=0 {alert('請選擇附件!');return false;}";
if(gv01.EditIndex>-1)
{
GridViewRow erow=gv01.Rows[gv01.EditIndex];
LinkButton btn=(LinkButton)erow.Cells[3].Controls[0];
btn.Attributes.Add("onclick",script);
//btn.Attributes.Add("onclick","return confirm('確定要更新此筆附件嗎?')");
}
}
{
string script="if document.getElementById('').size <=0 {alert('請選擇附件!');return false;}"; if(gv01.EditIndex>-1)
{
GridViewRow erow=gv01.Rows[gv01.EditIndex];
LinkButton btn=(LinkButton)erow.Cells[3].Controls[0];
btn.Attributes.Add("onclick",script);
//btn.Attributes.Add("onclick","return confirm('確定要更新此筆附件嗎?')");
}
}---------------------------------------
經測試,沒有用