.net表单提交代码(c语言网页填写提交表单)
admin 发布:2022-12-19 19:47 118
本篇文章给大家谈谈.net表单提交代码,以及c语言网页填写提交表单对应的知识点,希望对各位有所帮助,不要忘了收藏本站喔。
本文目录一览:
- 1、asp.net 提交表单, Response.Write代码执行不报错,为什么不弹出提示框?
- 2、asp.net 自动提交表单
- 3、ASP.NET提交表单怎么写
- 4、请问asp.net中如何在后台代码里提交表单
- 5、Asp.net中表单提交的问题
- 6、ASP.NET提交表单。急...
asp.net 提交表单, Response.Write代码执行不报错,为什么不弹出提示框?
一、控制台输出result的值,有可能值并不是返回的2061。
二、检查from表单的onsubmit事件,是否没有加return。onsubmit="return 方法名(this);"
asp.net 自动提交表单
你说的自动提交,是一次性自动提交,还是多次重复自动提交?
(1):用JS的setTimeout和setinterval进行提交就可以。
如果你只执行一次:setTimeout("function",time) ,到了你设定的时间自动提交。
如果是多次重复提交:setInterval("function",time) ,每到设定时间间隔就自动提交。
function 就是你写的提交函数:
time 就是你自己要设定的时间(单位为毫秒:1000就是1秒)
function jumpToAbcd()
{
jQuery(“form”).submit();
}
(2):或者你想页面一加载就提交:
jQuery(document).ready(function () {
jQuery(“form”).submit();
});
ASP.NET提交表单怎么写
在后台可以直接
this.控件ID.text
来取值
要提交到别别的页面,就需要修改form表单的action指向
post
提交,在需要接收数据的页面
request.form["控件ID"]
请问asp.net中如何在后台代码里提交表单
参考参考我的代码 链接Access数据库的:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using System.Configuration;
using System.Data.OleDb;
using System.Web.SessionState;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
//////Session["adm"] = TextBox1.Text;///////new add ???????
TextBox1.Text = "";
TextBox2.Text = "";
TextBox3.Text = "";
TextBox4.Text = "";
}
}
protected void Button1_Click(object sender, EventArgs e)
{
//////////////////////////////////////////////////输入判断
string strname,pwd1,pwd2,email;
strname = TextBox1.Text;
pwd1 = TextBox2.Text;
pwd2 = TextBox4.Text;
email = TextBox3.Text;
if (strname=="")
{
Response.Write("scriptalert('用户名输入不能为空')/script");
return;
}
if (pwd1 == "")
{
Response.Write("scriptalert('密码输入不能为空')/script");
return;
}
if (pwd2 == "")
{
Response.Write("scriptalert('您还未输入密码确认')/script");
return;
}
if (email == "")
{
Response.Write("scriptalert('请输入电子邮件')/script");
return;
}
if (pwd1!=pwd2)
{
Response.Write("scriptalert('两次密码输入不一致')/script");
return;
}
/////////////////////////////////////////////////////////////////////数据库链接.注册用户
OleDbConnection objconn = new OleDbConnection();
objconn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:/mysite1/AcDatebase/db1.mdb";
objconn.Open();
string objsql,username,password,useremail;
username=TextBox1.Text.Trim();
password=TextBox2.Text.Trim();
useremail=TextBox3.Text.Trim();
////////////////////////////////////////判断用户是否存在
string jack;
jack = "select * from denglu where name='" + username + "'";
//执行SQL语句
OleDbCommand Cmd = new OleDbCommand(jack, objconn);
//执行Datareader
OleDbDataReader dr = Cmd.ExecuteReader();
//作出判断
if (dr.Read())
{
Response.Write("scriptalert('用户名已经存在!');window.location='denglu.aspx';/script");
TextBox1.Text = "";
TextBox2.Text = "";
TextBox3.Text = "";
TextBox4.Text = "";
//用户存在...do something..
}
else
{
/////////////用户不存在,添加新用户
string objsqlscore;
objsql = "insert into denglu(name,pwd,email)values('" + username + "','" + password + "','" + useremail + "')";
objsqlscore = "insert into score(name)values('" + username + "')";
OleDbCommand objcmd = new OleDbCommand(objsql, objconn);
OleDbCommand objcmdscore = new OleDbCommand(objsqlscore, objconn);
objcmd.ExecuteNonQuery();
objcmdscore.ExecuteNonQuery();
objconn.Close();
Session["adm"] = TextBox1.Text;
Response.Write("scriptalert('注册成功!系统将会分配给您100的答题积分。请重新登陆。。。'); window.location='denglu.aspx';/script");
////Response.Redirect("gerenxinxi.aspx");存在,
/////////////scriptalert('注册成功!')/script无法显示
////// 添加 Session
///////////
//Session["adm"] = TextBox1.Text;
//Response.Redirect("gerenxinxi.aspx");
}
}
protected void Button2_Click(object sender, EventArgs e)
{
///////////////////////////////////////////////////////////////////////////////////////////用户登陆
OleDbConnection objconn = new OleDbConnection();
objconn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:/mysite1/AcDatebase/db1.mdb";
objconn.Open();
string objsql, username, password, useremail;
username = TextBox1.Text.Trim();
password = TextBox2.Text.Trim();
useremail = TextBox3.Text.Trim();
////////////////////////////////////////判断用户是否存在
string jack;
jack = "select name from denglu where name='" + username + "'";
//执行SQL语句
OleDbCommand Cmd1 = new OleDbCommand(jack, objconn);
//执行Datareader
OleDbDataReader dr1 = Cmd1.ExecuteReader();
//作出判断
if (!dr1.Read())
{
///////////////////////////////用户不存在
Response.Write("scriptalert('该用户名不存在!请先注册...');window.location='denglu.aspx';/script");
TextBox1.Text = "";
TextBox2.Text = "";
TextBox3.Text = "";
TextBox4.Text = "";
////用户不存在...do something..
return;
}
else
{
/////
///判断密码是否正确。。。。。。待补
string jackpwd;
jackpwd = "select name,pwd,email from denglu where name='" + username + "'and pwd='" + password + "'and email='" +useremail+ "'";
//执行SQL语句
OleDbCommand Cmd2 = new OleDbCommand(jackpwd, objconn);
//执行Datareader
OleDbDataReader dr2 = Cmd2.ExecuteReader();
if (dr2.Read())
{
////////////用户存在
/////添加 Session
//Session("adm") = TextBox1.Text;
Session["adm"] = TextBox1.Text;
Response.Redirect("kuangjia.aspx");
}
else
{
Response.Write("scriptalert('您输入的密码或者邮箱地址错误,请重新输入...');window.location='denglu.aspx';/script");
TextBox1.Text = "";
TextBox2.Text = "";
TextBox3.Text = "";
TextBox4.Text = "";
Session["adm"] = "";
}
}
//
//添加登陆程序。。。
//
}
protected void Button3_Click(object sender, EventArgs e)
{
/////////////////////////////////////////////////////////////////////////////////////取消操作
//Response.Redirect("denglu.aspx");
TextBox1.Text = "";
TextBox2.Text = "";
TextBox3.Text = "";
TextBox4.Text = "";
}
Asp.net中表单提交的问题
1、表单提交,
form
action=
"target.aspx"
method
=
"post"
name
=
"form1"
input
name
=
"param1"
value
=
"1111"/
/form
....
接收页面:Request.QueryString["param1"];
2、A
href="target.aspx?param1=1111param2=2222"链接地址传送/A
接收页面:
string
str
=
Request["param1"]
3、Session共享
发送页面:Session("param1")
=
"1111";
按收页面
string
str
=
Session("param1").ToString();
4、Application共享
发送页面:
Application("param1")
=
"1111";
按收页面:
string
str
=
Application("param1").ToString();
此种方法不常使用,因为Application在一个应用程序域范围共享,所有用户可以改变及设置其值,故只应用计数器等需要全局变量的地方。
5、Cookie
6、Response.Redirect()方式
Response.Redirect("target.aspx?param1=1111param2=2222")
接收页面:
string
str
=
Request["param1"]
7、Server.Transfer()方式。
Server.Transfer("target.aspx?param1=1111param2=2222")
接收页面:
string
str
=
Request["param1"]
ASP.NET提交表单。急...
" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %
!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ""
html xmlns=""
head runat="server"
title无标题页/title
script language=javascript
function keyDown()
{
var keycode=event.keyCode;
if(keycode==13)
event.keyCode=65;
}
document.onkeydown=keyDown;
/script
/head
body
form id="form1" runat="server" action="no.aspx"
div
asp:TextBox ID="TextBox2" runat="server"/asp:TextBox
br /
asp:TextBox ID="TextBox3" runat="server"/asp:TextBoxbr /
asp:TextBox ID="TextBox1" runat="server"/asp:TextBoxbr /
br /
asp:Button ID="Button1" runat="server" AccessKey="A" Text="Button" OnClick="Button1_Click" //div
/form
/body
/html
================
在Default.aspx.cs里写
protected void Button1_Click(object sender, EventArgs e)
{
Response.Redirect("");
}
试试能不能解决!!
另外,团IDC网上有许多产品团购,便宜有口碑
.net表单提交代码的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于c语言网页填写提交表单、.net表单提交代码的信息别忘了在本站进行查找喔。
版权说明:如非注明,本站文章均为 AH站长 原创,转载请注明出处和附带本文链接;
相关推荐
- 05-06单页网站的代码(完整的网页代码)[20240506更新]
- 05-06个人主页图片代码(个人主页图片代码怎么弄)[20240506更新]
- 05-06提取微信名片代码(微信名片信息提取)[20240506更新]
- 05-06php后台权限管理代码(php管理员权限)[20240506更新]
- 05-06付费观看代码php(付费观看代码)[20240506更新]
- 05-06在线html执行代码(html怎么运行)[20240506更新]
- 05-06源代码管理资源管理器(资源管理器运行代码)[20240506更新]
- 05-06代码源软件库(程序代码库)[20240506更新]
- 05-06点击弹出密码代码(点击弹出密码代码错误)[20240506更新]
- 05-06滚动导航代码(导航页面代码)[20240506更新]
取消回复欢迎 你 发表评论:
- 标签列表
- 最近发表
- 友情链接