服务器控件都是以合适的html语言发送到客户端的,因此你完全可以用js操控,如
文本框<asp:TextBox id="TextBox1" runat="server"></asp:TextBox>,在客户端为
<input name="TextBox1" type="text" id="TextBox1" />
下拉框
<asp:DropDownList id="DropDownList1" runat="server" Width="78px"></asp:DropDownList>
为
<select name="DropDownList1" id="DropDownList1" style="width:78px;Z-INDEX: 102; LEFT: 215px; POSITION: absolute; TOP: 317px">
发送到客户端时,自动加上了name属性,值和id的值相同
你要做的只是用js操作name="TextBox1"的input以及name="DropDownList1"的select,不用多说了吧:)
要提醒的一点是提交刷新后js修改的结果会清空,得手工提交到服务器端保存
文本框<asp:TextBox id="TextBox1" runat="server"></asp:TextBox>,在客户端为
<input name="TextBox1" type="text" id="TextBox1" />
下拉框
<asp:DropDownList id="DropDownList1" runat="server" Width="78px"></asp:DropDownList>
为
<select name="DropDownList1" id="DropDownList1" style="width:78px;Z-INDEX: 102; LEFT: 215px; POSITION: absolute; TOP: 317px">
发送到客户端时,自动加上了name属性,值和id的值相同
你要做的只是用js操作name="TextBox1"的input以及name="DropDownList1"的select,不用多说了吧:)
要提醒的一点是提交刷新后js修改的结果会清空,得手工提交到服务器端保存
解决方案 »
- 页面中iframe的问题!
- 很简单但很急很急的问题“无法对属性或索引器“string.this[int]”赋值 -- 它是只读的”
- (100分)问一个高难度的问题,没实力的不要进。。。
- gridview bottompagerr 里面包含的dropdownlist问题
- 急!!!在.net中用datagrid怎么实现三层表头,四层表头
- 需要不一般的“日期”正则表达式,但是不知表达式是否能实现我的功能
- 昨天没有人答出来,今天看你的了 关于data
- C#上传视频附件,通过在windows server 2008流媒体服务器,做一个在线观看上传的视频的工程
- SQL Server Agent 執行時間不準確
- cookie的问题(最后50’出血 放送)
- 如何对datagrid的页眉和页脚进行操作?
- Microsoft ASP.NET快速入门教程的原码???
DropDownList1.Attributes.Add("onchange","document.form[0].TextBox1.value=this.value"); 还要保证有提交的操作。 如果要在js中提交,调用__doPostBack(....)
下拉框
<asp:DropDownList id="DropDownList1" runat="server" Width="78px" onchange="this.form.TextBox1.value = this.value;"></asp:DropDownList>