对比<input type="text" id="">和<asp:TextBox runat="server" ID="">

本文探讨了ASP.NET中的TextBox控件与HTML中的input元素之间的相似性和互用性,尤其是在样式和JavaScript交互方面的一致性表现。

首先这两个都是对应文本输入框形式:

<input type="text"class="form-control"id="txt_add_pro_help_username"value="aaa"/>

<asp:TextBox runat="server"CssClass="form-control"ID="txt_add_pro_help_username"/>

    1)这两个在形式上是一模一样的,原因在于使用相同的class样式修饰。

    2)JS使用上也是一样的,虽然<asp:TextBox>是服务器控件,但是ID也是可以作为控件id在js上使用的。

  $("#txt_add_pro_help_username").val(result[2]);

  $("#txt_add_pro_help_userdept").val(result[3]);

         这两个一个是对应<input>形式的id,一个是对应<asp:TextBox>形式的id,结果都是一样的。

<html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <style type="text/css"> .GridViewStyle { border-collapse: collapse; width: 100%; text-align:center } .GridViewStyle th, .GridViewStyle td { border: 1px solid #ddd; padding: 8px; } .GridViewStyle tr:hover { background-color: #f1f1f1; } </style> <body> <form id="form1" runat="server"> <div> <asp:Button ID="downloadmon1" runat="server" Text="下载数据" OnClick="downloadmon1_Click" /> <asp:FileUpload ID="FileUp" runat="server" Text="选择文件"/> <asp:Button ID="btn_ExInto_pass" runat="server" Text="导入" OnClick="btn_ExInto_pass_Click" /> </div> <div> <asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" CssClass="GridViewStyle" DataKeyNames="Dept,Week,Month" AutoGenerateEditButton="False" AllowPaging="True" PageSize="20" Visible="false"> <Columns> <asp:BoundField DataField="Plant" HeaderText="Plant" ReadOnly="True" /> <asp:BoundField DataField="Dept" HeaderText="Dept" ReadOnly="True"/> <asp:BoundField DataField="Month" HeaderText="Month" ReadOnly="True"/> <asp:BoundField DataField="Week" HeaderText="Week" ReadOnly="True"/> <asp:TemplateField HeaderText="OT_Time"> <ItemTemplate> <asp:Label ID="lblEmail" runat="server" Text='<%# Bind("OT_Time") %>'></asp:Label> </ItemTemplate> <EditItemTemplate> <asp:TextBox ID="txtEmail" runat="server" Text='<%# Bind("OT_Time") %>'></asp:TextBox> </EditItemTemplate> </asp:TemplateField> <asp:TemplateField ShowHeader="False"> <ItemTemplate> <asp:LinkButton ID="lnkEdit" runat="server" CausesValidation="False" CommandName="Edit" Text="Edit"></asp:LinkButton> </ItemTemplate> <EditItemTemplate> <asp:LinkButton ID="lnkUpdate" runat="server" CommandName="Update" Text="Update"></asp:LinkButton> <asp:LinkButton ID="lnkCancel" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel"></asp:LinkButton> </EditItemTemplate> </asp:TemplateField> </Columns> <HeaderStyle Wrap="False" /> </asp:GridView> </div> <div> <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CssClass="GridViewStyle" DataKeyNames="Dept,Week,Month" DataSourceID="SqlDataSource1" AutoGenerateEditButton="False" AllowPaging="True" PageSize="20"> <Columns> <asp:BoundField DataField="Plant" HeaderText="Plant" ReadOnly="True" /> <asp:BoundField DataField="Dept" HeaderText="Dept" ReadOnly="True"/> <asp:BoundField DataField="Month" HeaderText="Month" ReadOnly="True"/> <asp:BoundField DataField="Week" HeaderText="Week" ReadOnly="True"/> <asp:TemplateField HeaderText="OT_Time"> <ItemTemplate> <asp:Label ID="lblEmail" runat="server" Text='<%# Bind("OT_Time") %>'></asp:Label> </ItemTemplate> <EditItemTemplate> <asp:TextBox ID="txtEmail" runat="server" Text='<%# Bind("OT_Time") %>'></asp:TextBox> </EditItemTemplate> </asp:TemplateField> <asp:TemplateField ShowHeader="False"> <ItemTemplate> <asp:LinkButton ID="lnkEdit" runat="server" CausesValidation="False" CommandName="Edit" Text="Edit"></asp:LinkButton> </ItemTemplate> <EditItemTemplate> <asp:LinkButton ID="lnkUpdate" runat="server" CommandName="Update" Text="Update"></asp:LinkButton> <asp:LinkButton ID="lnkCancel" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel"></asp:LinkButton> </EditItemTemplate> </asp:TemplateField> </Columns> <HeaderStyle Wrap="False" /> </asp:GridView> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ApplicationServices %>" SelectCommand="SELECT A.* FROM [Assembly].[dbo].[MPE_HC_OT] AS A LEFT JOIN (SELECT TOP 1 'WW'+Week AS Time FROM [Assembly].[dbo].[MPE_Loading_PTime_Dept_Week] WHERE DEPT='AG1') AS B ON A.WEEK>= B.TIME WHERE A.Week >= B.Time ORDER BY A.Month" UpdateCommand="UPDATE MPE_HC_OT SET OT_Time=@OT_Time,OT_Time_Active='1' WHERE Dept=@Dept and Month=@Month and Week= @Week"> </asp:SqlDataSource> </div> </form> </body> </html>
08-16
<%@ Page Language=“C#” AutoEventWireup=“true” CodeFile=“AddNewUser.aspx.cs” Inherits=“Admin_lizhitong_AddNewUser” %> <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”> <html xmlns=“http://www.w3.org/1999/xhtml”> <head runat=“server”> <title>注册新用户</title> <link href=“/css/Style.css” rel=“stylesheet” type=“text/css” /> </head> <body> <form id=“form1” runat=“server”> <div> <table border=“0” width=“100%” cellspacing=“1” cellpadding=“2” id=“table2” class=“tableBorder”> <tr> <th valign=“middle” colspan=“2” height=“25”> <table align=“center” width=“100%”> <tr> <td width=“96%” colspan=“2”> 注册用户 </td> </tr> </table> </th> </tr> <tr> <td width=“150” height=“47” align=“center” class=“forumRow”> 用户名: </td> <td class=“forumRow” align=“left”> <asp:TextBox ID=“tbYHM” runat=“server” Height=“19px” Width=“200px” spellcheck=“false” autocomplete=“off” aria-autocomplete=“none”></asp:TextBox> </td> </tr> <tr> <td width=“150” height=“47” align=“center” class=“forumRow”> 用户密码: </td> <td class=“forumRow” align=“left”> <asp:TextBox ID=“tbYHMM” runat=“server” Height=“19px” Width=“200px” spellcheck=“false” autocomplete=“off” aria-autocomplete=“none”></asp:TextBox> </td> </tr> <tr> <td width=“150” height=“47” align=“center” class=“forumRow”> 确认密码: </td> <td class=“forumRow” align=“left”> <asp:TextBox ID=“tbQRMM” runat=“server” Height=“19px” Width=“200px” spellcheck=“false” autocomplete=“off” aria-autocomplete=“none”></asp:TextBox> <asp:Literal ID=“mmErrorMessage” runat=“server”></asp:Literal> </td> </tr> <tr> <td width=“150” height=“47” align=“center” class=“forumRow”> 用户姓名: </td> <td class=“forumRow” align=“left”> <asp:TextBox ID=“tbYHXM” runat=“server” Height=“19px” Width=“200px” spellcheck=“false” autocomplete=“off” aria-autocomplete=“none”></asp:TextBox> </td> </tr> <tr> <td width=“80” height=“47” align=“center” class=“forumRow”> 所属区域: </td> <td class=“forumRow” align=“left”> <div class=“dropdown-container” style=“max-width: 450px;”> <asp:DropDownList ID=“ddlZJ” CssClass=“custom-dropdown” runat=“server” AutoPostBack=“True” onselectedindexchanged=“ddlZJ_SelectedIndexChanged”></asp:DropDownList> <asp:DropDownList ID=“ddlPCS” CssClass=“custom-dropdown” runat=“server” AutoPostBack=“True” onselectedindexchanged=“ddlPCS_SelectedIndexChanged”></asp:DropDownList> <asp:DropDownList ID=“ddlVillage” CssClass=“custom-dropdown” runat=“server” AutoPostBack=“True”></asp:DropDownList> </div> </td> </tr> <tr> <td width=“150” height=“47” align=“center” class=“forumRow”> 工作单位: </td> <td class=“forumRow” align=“left”> <asp:TextBox ID=“tbGZDW” runat=“server” Height=“19px” Width=“200px” spellcheck=“false” autocomplete=“off” aria-autocomplete=“none”></asp:TextBox> <td class=“forumRow” align=“left”> <asp:DropDownList ID=“ddlYHJS” CssClass=“custom-dropdown” style=“width:300px;” runat=“server”></asp:DropDownList> </td> </tr> <tr> <td valign="middle" colspan="2" align="center" class="forumRow"> <span style="color: Red; padding-left: 10px;"> <asp:Button ID="btSubmit" runat="server" Text="提交注册" OnClick="btSubmit_Click" />  <asp:Literal ID="ltMessage" runat="server"></asp:Literal></span> </td> </tr> </table> </div> </form> </body> </html> 怎么让tbQRMMtbYHMM显示为*号,不用TextMode="Password"方法
03-22
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值