在asp.net中使用javascript [英] using javascript in asp.net

查看:70
本文介绍了在asp.net中使用javascript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好我在aspx设计视图中有一个按钮。按钮点击我在aspx.cs页面写的

Button1.Attributes.Add(onClick,return confirm('你确定你想要重定向到其他页面?'););.如果用户点击是,它应该使用response.redirect()重定向到其他页面;

任何人都可以告诉我如何实现这个?

hello i have a button in aspx design view.on button click i have written in aspx.cs page
Button1.Attributes.Add("onClick", "return confirm('You sure you want to redirect to other page?');");.if user clicks yes it should redirect to some other page using response.redirect("");
Can anyone tell me how can i achieve this?

推荐答案

我们可以通过两种方式实现这个目标



1)通过在服务器端添加代码C#如下所示



btn.Attributes.Add(onclick,返回确认('你确定要重定向到其他页面?');客户端,jQuery



We can achieve this by two ways

1) By adding code in server side C# like below

btn.Attributes.Add("onclick", " return confirm('You sure you want to redirect to other page?');");

2) by client side, with jQuery


(function(){
(function(){


('


这篇关于在asp.net中使用javascript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆