社区
C#
帖子详情
在ASP.NET 2.0中如果把TextBox的ReadOnly=true后,提交后TextBox.Text无值!!!
sense
2005-11-12 12:34:57
在ASP.NET 2.0中如果把TextBox的ReadOnly=true,然后通过JavaScript设值,提交后TextBox.Text无值;如果ReadOnly=false,提交就可以!!
注:在ASP.NET 1.X中无此问题
大侠帮帮忙
...全文
120
2
打赏
收藏
在ASP.NET 2.0中如果把TextBox的ReadOnly=true后,提交后TextBox.Text无值!!!
在ASP.NET 2.0中如果把TextBox的ReadOnly=true,然后通过JavaScript设值,提交后TextBox.Text无值;如果ReadOnly=false,提交就可以!! 注:在ASP.NET 1.X中无此问题 大侠帮帮忙
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
2 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
liuxingsijia
2005-12-03
打赏
举报
回复
我也碰到过,你不如把enabled=false
fgcsh
2005-11-13
打赏
举报
回复
用Request来接收
asp.net
Text
Box
控件设置
ReadOnly
后,不能回传。
很奇怪,以前都没有过这样的怪问题,在别人机器上都能正常,想到可能和
ASP.NET
的版本有关系。 我用的是
ASP.NET
2.0
,当改成
ASP.NET
1.0,就正常了,
Text
Box
控件
ReadOnly
=
True
,能回传。 在
ASP.NET
1.0
中
是
ReadOnly
=
True
会回传的。 在
ASP.NET
2.0
中
是
ReadOnly
=
True
就不会回传了。 解决的方法:
ReadOnly=”
True
”>
去掉
ReadOnly
=”
True
”,改成 <asp:
text
box
My97DatePicker日期控件
asp.net
很好用的
ASP.net
日期控件。使用方法: 1,放到javascript目录 2,
ASP.net
页面添加引用 <script language="javascript" type="
text
/javascript" src="../../../JavaScript/My97DatePicker/WdatePicker.js" defer="defer"> 3,控件里引用脚本
Text
Box ID="txtLiXiangRiQi" runat="server" MaxLength="4" class="Wdate" onFocus="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false,
readOnly
:
true
})" Width="204px" />
asp.net
无限级分类
asp.net
无限级分类 <%@ Page Language="C#" AutoEventWireup="
true
" CodeFile="Default.aspx.cs" Inherits="_Default" %>
无限级菜单显示
Text="目录名称:">
Text
Box ID="txt_menu" runat="server" Font-Size="12px">
Text
Box>
*
Text="添加" />
Text="ID"
ReadOnly
="
True
" />
Text="栏目名称" />
Text="编辑" ShowEditButton="
True
" />
Text="删除" ShowDeleteButton="
True
" />
asp.net
无限级菜单显示实例源码
<%@ Page Language="C#" AutoEventWireup="
true
" CodeFile="Default.aspx.cs" Inherits="_Default" %>
无限级菜单显示
Text="目录名称:">
Text
Box ID="txt_menu" runat="server" Font-Size="12px">
Text
Box>
*
Text="添加" />
Text="ID"
ReadOnly
="
True
" />
Text="栏目名称" />
Text="编辑" ShowEditButton="
True
" />
Text="删除" ShowDeleteButton="
True
" />
经典cookie购物车源码[GridView实现]
特别说明请注意: 根许多网友反应, using Maticsoft.Functions; 这些代码看不懂 其实Functions 这个dll是我定义常用的函数类,如果需要跟我联系索取http://sql8.net 下面有我的群号, 其
中
ArtsShop.Model.Arts_Product _p = new ArtsShop.Model.Arts_Product(); ArtsShop.BLL.Arts_Product p = new ArtsShop.BLL.Arts_Product(); _p = p.GetModel(id); 这是我的商品信息的类,三层结构,这个在用时你们只能换成你们自己的,这些代码完全可以删除, 比如 MyDr[1] = _p.Title; 用来读取商品名的,你们可以改MyDr[1] = dr["productname"].ToString();就行了, AddToCart.aspx页面代码 无标题页
Text
Box ID="
Text
Box
1" runat="server"
Text
='' Width="44px">
Text=''> 保存 取消 编辑 继续购物 清空购物车 下订单 AddToCart.aspx.cs页面代码 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 Maticsoft.Functions;public partial class AddToCart : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { int ProID; HttpCookie cookie; bool Tempbl = false; string Tempstr; if (!Page.IsPostBack) { if (!object.Equals(Request.QueryString["id"], null)) { ProID = int.Parse(Request.QueryString["id"]); //创购物车cookie yxy .//sql8.net if (object.Equals(Request.Cookies["ztbscart"], null)) cookie = new HttpCookie("ztbscart"); else cookie = Request.Cookies["ztbscart"]; //判断是否已存在于购物车内 yxy // sql8.net for (int i = 0; i < cookie.Values.Keys.Count; i++) { if (!object.Equals(cookie.Values.Keys[i], null)) { Tempstr = cookie.Values.AllKeys[i].ToString(); if (Tempstr.Trim() != "") { if (ProID == int.Parse(cookie.Values.AllKeys[i])) { Tempbl =
true
; break; } } } } //不未购买过则加入购物车 yxy //sql8.net if (!Tempbl) cookie.Values.Add(ProID.ToString(), "1"); else { } TimeSpan ts = new TimeSpan(0, 0, 10, 0); cookie.Expires = DateTime.Now + ts; Response.AppendCookie(cookie); } BindGrid(); } } //绑定数据 yxy //sql8.net private void BindGrid() { DataTable MyDt; DataRow MyDr; string str = ""; MyDt = new DataTable(); MyDt.Columns.Add(new DataColumn("id", str.GetType())); MyDt.Columns.Add(new DataColumn("Title", str.GetType())); MyDt.Columns.Add(new DataColumn("Num", str.GetType())); MyDt.Columns.Add(new DataColumn("Price", str.GetType())); MyDt.Columns.Add(new DataColumn("Discount", str.GetType())); MyDt.Columns.Add(new DataColumn("Vipprice", str.GetType())); MyDt.Columns.Add(new DataColumn("Totle", str.GetType())); if (!object.Equals(Request.Cookies["ztbscart"], null)) { HttpCookie cookie = Request.Cookies["ztbscart"]; double Totle; //Response.Write("|" + Request.Cookies["ztbscart"].Values.Keys[1].ToString() + "|"); //Response.End(); for (int i = 0; i < cookie.Values.Keys.Count; i++) { int id; MyDr = MyDt.NewRow(); if (cookie.Values.AllKeys[i] != "" && cookie.Values[i] != "") { id = int.Parse(cookie.Values.AllKeys[i].ToString()); ArtsShop.Model.Arts_Product _p = new ArtsShop.Model.Arts_Product(); ArtsShop.BLL.Arts_Product p = new ArtsShop.BLL.Arts_Product(); _p = p.GetModel(id); MyDr[0] = id; MyDr[1] = _p.Title; MyDr[2] = cookie.Values[i]; MyDr[3] = _p.Price; MyDr[4] = _p.Discount; MyDr[5] = _p.Vipprice1; Totle = double.Parse(MyDr[2].ToString()) * double.Parse(MyDr[5].ToString()); MyDr[6] = Totle; MyDt.Rows.Add(MyDr); } } GridView1.DataSource = MyDt.DefaultView; GridView1.DataBind(); } } protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e) { //编辑某行数量 yxy //sql8.net GridView1.EditIndex = e.NewEditIndex; BindGrid(); } protected void GridView1_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e) { //取消更新 yxy //sql8.net GridView1.EditIndex = -1; BindGrid(); } protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e) { //更新数量 yxy //sql8.net string num;
Text
Box
tempbx = new
Text
Box
(); Label templb = new Label(); tempbx = (
Text
Box
)(GridView1.Rows[e.RowIndex].Cells[6]).Controls[1]; num = tempbx.
Text
.ToString(); HttpCookie cookie = new HttpCookie("ztbscart"); for (int i = 0; i < GridView1.Rows.Count; i++) { string id; string tempnum; id = GridView1.Rows[i].Cells[1].
Text
.ToString(); if (e.RowIndex == i) tempnum = num; else { templb = (Label)(GridView1.Rows[i].Cells[6]).Controls[1]; tempnum = templb.
Text
.ToString(); } if (tempnum.Trim() == "") tempnum = "0"; //Response.Write("ID:"+id.ToString() + "Num:"+tempnum+":"+i+"");//测试用途 yxy//sql8.net cookie.Values.Add(id, tempnum); } //Response.End(); TimeSpan ts = new TimeSpan(0, 0, 10, 0); cookie.Expires = DateTime.Now + ts; Response.AppendCookie(cookie); GridView1.EditIndex = -1; Message.GoTo("AddToCart.aspx"); } protected void LinkButton4_Click(object sender, EventArgs e) { //继续购物 yxy //sql8.net Message.WebClose(); } protected void LinkButton3_Click(object sender, EventArgs e) { //清空购物车 yxy //sql8.net CheckBox tempcb = new CheckBox(); HttpCookie cookie = new HttpCookie("ztbscart"); Label templb = new Label(); for (int i = 0; i < GridView1.Rows.Count; i++) { tempcb = (CheckBox)(GridView1.Rows[i].Cells[0]).Controls[1]; if (!tempcb.Checked) { string id; string tempnum; id = GridView1.Rows[i].Cells[1].
Text
.ToString(); templb = (Label)(GridView1.Rows[i].Cells[6]).Controls[1]; tempnum = templb.
Text
.ToString(); if (tempnum.Trim() == "") tempnum = "0"; //Response.Write("ID:"+id.ToString() + "Num:"+tempnum+":"+i+"");//测试用途 yxy//sql8.net cookie.Values.Add(id, tempnum); } } TimeSpan ts = new TimeSpan(0, 0, 10, 0); cookie.Expires = DateTime.Now + ts; Response.AppendCookie(cookie); Message.GoTo("AddToCart.aspx"); } protected void CheckAll_CheckedChanged(object sender, EventArgs e) { //全选事件 yxy //sql8.net CheckBox tempcb = new CheckBox(); bool tempbl; tempcb = (CheckBox)(GridView1.HeaderRow.Cells[0]).Controls[1]; tempbl = tempcb.Checked; for (int i = 0; i < GridView1.Rows.Count; i++) { tempcb = (CheckBox)(GridView1.Rows[i].Cells[0]).Controls[1]; tempcb.Checked = tempbl; } } } _________________________________________________________________________ 如转载请注明原出处 www.sql8.net
C#
110,566
社区成员
642,567
社区内容
发帖
与我相关
我的任务
C#
.NET技术 C#
复制链接
扫一扫
分享
社区描述
.NET技术 C#
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
让您成为最强悍的C#开发者
试试用AI创作助手写篇文章吧
+ 用AI写文章