在一个DataGrid里我放进了一个普通的按纽。 CommandName="RePublish",这个按纽的事件怎么触发?谢谢! <asp:LinkButton CommandName="RePublish" id="btnRePublish" runat="server">重发</asp:LinkButton> 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 在Datagrid的ItemCommand事件中触发 Datagrid的ItemCommand内if(e.CommandName="RePublish") { .............} 唉.........在设计页面选中 Datagrid ,然后选属性 --> 事件双击 ItemCommand 后的空白部分这时会自动转到代码页面在里面写if(e.CommandName == "RePublish"){.....你想要实现的逻辑.....}就可以了 int id=int.Parse(dgComInfo.DataKeys[e.Item.ItemIndex].ToString()); if(e.CommandName.Equals("delete")) { bool result=c.DeleteComInfo(id); string str=((TextBox)e.Item.FindControl("TextBox1")).Text; string imagepath=Server.MapPath("")+"\\Images\\"+str; if(System.IO.File.Exists(imagepath)) { System.IO.File.Delete(imagepath); } if(result) { RegisterStartupScript("Succeed","<script>alert('企业名录删除成功')</script>"); BindData(); } } else if(e.CommandName.Equals("update")) { Response.Redirect("UpdateComInfo.aspx?cid="+id+""); } else if(e.CommandName.Equals("vouch")) { Response.Redirect("VouchComInfo.aspx?cid="+id+""); }这是在DataGrid_ItemCommand事件中实现的有删除、修改和推荐,但一定要设CommandName属性 触发Datagrid的ItemCommand事件然后在这个事件中判断具体是那个按钮触发的,然后进行相应的处理if(e.CommandName="RePublish") { .............} 如何获取FLV视频的时间长度。 .NET后台生成js字符串 !!!!!!!!高手 come in!!! 请问在运用Ajax的情况下,如何在自定义类中弹出提示框问题! c# 数据采集? 求教 求大图生成小图的代码(不是很小的缩略图) 新手:如何读写XML文件啊? 怎样把字符串“Week,Night”导出到CSV文件的一个Cell ? 请问做asp.net控件开发,如果将js编译放到控件库里面去 @Html.EditorFor的问题。 怎么样实现在asp.net页面中把datagrid中的数据导入excel中?? Sqlserver进程 占用CPU 100%问题,请大家指点!!
if(e.CommandName="RePublish")
{ .............}
if(e.CommandName == "RePublish")
{
.....你想要实现的逻辑.....
}
就可以了
if(e.CommandName.Equals("delete"))
{
bool result=c.DeleteComInfo(id);
string str=((TextBox)e.Item.FindControl("TextBox1")).Text;
string imagepath=Server.MapPath("")+"\\Images\\"+str;
if(System.IO.File.Exists(imagepath))
{
System.IO.File.Delete(imagepath);
}
if(result)
{
RegisterStartupScript("Succeed","<script>alert('企业名录删除成功')</script>");
BindData();
}
}
else if(e.CommandName.Equals("update"))
{
Response.Redirect("UpdateComInfo.aspx?cid="+id+"");
}
else if(e.CommandName.Equals("vouch"))
{
Response.Redirect("VouchComInfo.aspx?cid="+id+"");
}这是在DataGrid_ItemCommand事件中实现的
有删除、修改和推荐,但一定要设CommandName属性
然后在这个事件中判断具体是那个按钮触发的,然后进行相应的处理if(e.CommandName="RePublish")
{ .............}