asp.net c#弹出确认/取消对话框 你这是Web应用。你这种功能不可能实现。当你实现弹出对话框的时候,这一次请求就已经结束。下一次请求不会从弹出对话框的位置继续执行。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 webform,用js写个相应的方法,然后指定onclick事件。判断的话用confirmwinform,if (MessageBox.Show("确定", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes){ //do sth}else{return;} JS操作Confirm("你确定要怎的?");如果是服务端控件:OnClientClick 在page_onload事件里给你要点击的按钮添加如下属性 this.SubmitButton.Attributes.Add("onclick", "return confirm('你确定提交吗?');"); 一、使用GridView控件 <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AutoGenerateColumns="False" CellPadding="4" Font-Size="9pt" ForeColor="#333333" GridLines="None" OnPageIndexChanging="GridView1_PageIndexChanging" OnRowDataBound="GridView1_RowDataBound" OnRowDeleting="GridView1_RowDeleting" Width="500px"> <FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" /> <RowStyle BackColor="#E3EAEB" /> <Columns> <asp:BoundField DataField="ST_l_id" HeaderText="地址ID" /> <asp:BoundField DataField="ST_l_name" HeaderText="网站名称" /> <asp:BoundField DataField="ST_l_url" HeaderText="链接网址" /> <asp:HyperLinkField DataNavigateUrlFields="ST_l_id" DataNavigateUrlFormatString="AmendLink.aspx?ID={0}" HeaderText="修改" Text="修改" /> <asp:CommandField HeaderText="删除" ShowDeleteButton="True" /> </Columns> <SelectedRowStyle BackColor="#C5BBAF" ForeColor="#333333" Font-Bold="True" /> <PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" /> <HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" /> <EditRowStyle BackColor="#7C6F57" /> <AlternatingRowStyle BackColor="White" /> </asp:GridView>二、处理程序如:protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { SqlData da = new SqlData(); da.ExceSQL("delete from ST_link where ST_l_id='" + GridView1.DataKeys[e.RowIndex].Value + "'"); Page.Response.Redirect("LinkManage.aspx"); } protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e) { GridView1.PageIndex = e.NewPageIndex; GridView1.DataBind();//CodeGo.net } protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { if ((e.Row.Cells[1].Text).Length > 6) { e.Row.Cells[1].Text = (e.Row.Cells[1].Text).Substring(0, 6) + "…"; } if ((e.Row.Cells[0].Text).Length > 6) { e.Row.Cells[0].Text = (e.Row.Cells[0].Text).Substring(0, 6) + "…"; } if ((e.Row.Cells[0].Text).Length > 6) { e.Row.Cells[0].Text = (e.Row.Cells[0].Text).Substring(0, 6) + "…"; } } if (e.Row.RowType == DataControlRowType.DataRow) { ((LinkButton)(e.Row.Cells[4].Controls[0])).Attributes.Add("onclick", "return confirm('确定删除吗?')"); } 求助~~!用jquery的ajax方法调用其他页面的后台指定的方法始终不行 带html 标签内容插入数据库报错 RDLC报表如何控制单元格的小数位数 vs2010 安装问题 代码和页面分开问题 JS小问题 (web项目)打包工具大家都用的什么??vs.net自带的有些不方便 看看我的web.config配置哪里有问题? 请教:怎么样实现论坛表情图片插入贴子中的功能? 如何使用自定义控件中的WEB控件 WPF RichTextBox 遍历 求代码!!! 全国三十几个点上传,采用bs架构集中存储行不
winform,if (MessageBox.Show("确定", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
{
//do sth
}
else
{
return;
}
Confirm("你确定要怎的?");如果是服务端控件:OnClientClick
this.SubmitButton.Attributes.Add("onclick", "return confirm('你确定提交吗?');");
<asp:GridView ID="GridView1" runat="server" AllowPaging="True" AutoGenerateColumns="False"
CellPadding="4" Font-Size="9pt" ForeColor="#333333" GridLines="None" OnPageIndexChanging="GridView1_PageIndexChanging"
OnRowDataBound="GridView1_RowDataBound" OnRowDeleting="GridView1_RowDeleting"
Width="500px">
<FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
<RowStyle BackColor="#E3EAEB" />
<Columns>
<asp:BoundField DataField="ST_l_id" HeaderText="地址ID" />
<asp:BoundField DataField="ST_l_name" HeaderText="网站名称" />
<asp:BoundField DataField="ST_l_url" HeaderText="链接网址" />
<asp:HyperLinkField DataNavigateUrlFields="ST_l_id" DataNavigateUrlFormatString="AmendLink.aspx?ID={0}"
HeaderText="修改" Text="修改" />
<asp:CommandField HeaderText="删除" ShowDeleteButton="True" />
</Columns>
<SelectedRowStyle BackColor="#C5BBAF" ForeColor="#333333" Font-Bold="True" />
<PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" />
<HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
<EditRowStyle BackColor="#7C6F57" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>
二、处理程序如:
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
SqlData da = new SqlData();
da.ExceSQL("delete from ST_link where ST_l_id='" + GridView1.DataKeys[e.RowIndex].Value + "'");
Page.Response.Redirect("LinkManage.aspx");
}
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
GridView1.PageIndex = e.NewPageIndex;
GridView1.DataBind();//CodeGo.net
} protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
if ((e.Row.Cells[1].Text).Length > 6)
{
e.Row.Cells[1].Text = (e.Row.Cells[1].Text).Substring(0, 6) + "…";
}
if ((e.Row.Cells[0].Text).Length > 6)
{
e.Row.Cells[0].Text = (e.Row.Cells[0].Text).Substring(0, 6) + "…";
}
if ((e.Row.Cells[0].Text).Length > 6)
{
e.Row.Cells[0].Text = (e.Row.Cells[0].Text).Substring(0, 6) + "…";
}
}
if (e.Row.RowType == DataControlRowType.DataRow)
{
((LinkButton)(e.Row.Cells[4].Controls[0])).Attributes.Add("onclick", "return confirm('确定删除吗?')");
}