问个DataGrid中控件加提示的问题

ma_ta 2004-11-22 10:01:20
我的DataGrid控件中有下面这个编辑按钮:
<asp:EditCommandColumn EditText="更改" ButtonType="PushButton" UpdateText="更新" CancelText="取消">
<ItemStyle Wrap="False" HorizontalAlign="Center" Width="80px"></ItemStyle>
</asp:EditCommandColumn>
现在我需要在用户更新的时候弹出确认提示,如果确定就继续执行服务端代码,取消就不执行
以前做的都是给asp:button加提示,跟这个不一样
...全文
119 6 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
ma_ta 2004-11-24
  • 打赏
  • 举报
回复
晕,难道这个也没人会吗?
ma_ta 2004-11-23
  • 打赏
  • 举报
回复
顶下
ma_ta 2004-11-22
  • 打赏
  • 举报
回复
ItemDataBound的时候只有1个"更改"按钮,怎么给"更新"按钮加事件啊?
thooy 2004-11-22
  • 打赏
  • 举报
回复
这个好做!
private void DataGrid_ItemDataBound(object sender, DataGridItemEventArgs e)
{

if (((e.Item.ItemType != ListItemType.AlternatingItem) && (e.Item.ItemType != ListItemType.Item)) && (e.Item.ItemType != ListItemType.EditItem))
{
return;
}
LinkButton button1 = (LinkButton) e.Item.Cells[7].Controls[0];
button31.Attributes.Add("onclick", "return confirm('您确定要更新该记录吗?')");
}
别忘了在DataGrid中加上:onItemDataBound="DataGrid_ItemDataBound"



ma_ta 2004-11-22
  • 打赏
  • 举报
回复
1、DataGrid自己的编辑控件,如何设置并且取到控件ID "btnUpdate"?
2、为什么要用e.Item.ItemType来循环?^_^!
huqiyang 2004-11-22
  • 打赏
  • 举报
回复
private void DataGrid1_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
switch(e.Item.ItemType)
{
case(ListItemType.Item):
case(ListItemType.AlternatingItem):
{
Button btn=(Button)e.Item.FindControl("btnUpdate");
btn.Attributes.Add("OnClick","return confirm('您确定要更新该记录吗?');");
break;
}
}
}
资源下载链接为: https://pan.quark.cn/s/9e7ef05254f8 在 Python 生态,pip 和 conda 是常用的库管理与安装工具。但因网络状况,在国内直接连官方仓库常会速度慢甚至连不上。为改善此状况,可切换到国内镜像服务器,如清华 TUNA 的镜像服务,以下分别介绍 pip 和 conda 的配置方法。 对于 conda,首先它是一个含丰富 Python 包及环境管理功能的流行科学计算平台。要更换国内源,可去清华 TUNA 的镜像站下载安装包,其也提供了 Anaconda 仓库及第三方源镜像。在 Linux 或 Mac 系统,可在用户目录下创建或编辑 .condarc 文件,文件内容如下: Windows 用户因系统限制无法直接创建以 . 开头的文件名,可通过运行 conda config --set show_channel_urls yes 来生成 .condarc 文件,再按上述内容编辑。之后执行 conda clean -i 清除索引缓存,以确保使用镜像站索引。最后用 conda create -n myenv numpy 命令测试配置是否成功。 对于 pip,临时更换源可在 pip install 命令时 -i 参数指定源,如 pip install scrapy -i https://pypi.tuna.tsinghua.edu.cn/simple 。永久更换源,Linux 系统在 ~/.pip/pip.conf(无则创建)以下内容: Windows 和 Mac 用户分别在 %USERPROFILE%\pip\pip.ini(Windows)或 $HOME/Library/Application Support/pip/pip.conf(Mac)进行相同配置。 通过上述步骤,能提高 pip 和 conda 在国内的安

111,092

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • AIGC Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧