WEB FORM 开发代码资料积累,仅供参考分享(部分来自网友分析后编辑)——不喜勿喷

9 篇文章 0 订阅
2 篇文章 0 订阅

WEB FORM 开发代码资料积累,仅供参考分享(部分来自网友分析后编辑)——不喜勿喷

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

Asp.net中时间格式化的几种方法1

DataBinder.Eval(Container.DataItem,“AddTime”,“{0:yyyy-MM-dd HH:mm:ss}”)

格式化日期

DataFormatString=“{0:G}”
G 一般格式 (short date + long time) MM/dd/yyyy HH:mm:ss


DropDownlist添加第一项

ddlpathtype.Items.Insert(0, new ListItem(“-请选择-”, “”));


使用JQuery浏览插件可以很方便的进行局部打印,常用的插件有:

1)jquery.print.js 下载地址:https://github.com/DoersGuild/jQuery.print

2)jquery.print-preview.js 下载地址:https://github.com/etimbo/jquery-print-preview-plugin

这两种方式使用都很简单,1)通过KaTeX parse error: Expected 'EOF', got '#' at position 3: (“#̲id”).print(/*op…(‘#id’).printArea(/options/); 其中的option可选项可以在下载地址下载下来后看示例代码,一般options不用传即可,示例代码如下:


打印预览

function previewPrint() {
$(‘body’).print({
globalStyles: true,
mediaPrint: false,
stylesheet: null,
noPrintSelector: “.no-print”,
iframe: true,
append: null,
prepend: null,
manuallyCopyFormValues: true,
deferred: $.Deferred(),
timeout: 250,
title: null,
doctype: ‘’,
removeScripts: false,
copyTagClasses: false
});
}



$(“#myElementId”).print({

        globalStyles:true,//是否包含父文档的样式,默认为true

        mediaPrint:false,//是否包含media='print'的链接标签。会被globalStyles选项覆盖,默认为false

        stylesheet:null,//外部样式表的URL地址,默认为null

        noPrintSelector:".no-print",//不想打印的元素的jQuery选择器,默认为".no-print"

        iframe:true,//是否使用一个iframe来替代打印表单的弹出窗口,true为在本页面进行打印,false就是说新开一个页面打印,默认为true

        append:null,//将内容添加到打印内容的后面

        prepend:null,//将内容添加到打印内容的前面,可以用来作为要打印内容

        deferred: $.Deferred()//回调函数

        });

金蝶云星空资料

http://open.kingdee.com/K3Cloud/CDPPortal/DataModel.aspxhttps://vip.kingdee.com/article/76704611012022784云星空
使用PDMReader查找数据字典金蝶云星空系统集成(WebAPI)【汇总贴】
https://vip.kingdee.com/article/76278025062688512?productLineId=1若对上述的答复有异议,请及时与我们联系(使用【未解决退回】将工单退回给我或重新来电4008836836热线找工号36886)我将竭诚为您服务,感谢您的反馈与支持!
星空精华课程欢迎访问(持续更新中):
https://pan.yunzhijia.com/edit#/294036849066831872/为了给您提供更好的服务,请对我的服务进行评价,谢谢!


9、希赛

希赛实力雄厚,拥有一支过硬的全职顶级教师队伍,业界口碑好,腾讯、华为、太平洋保险等近500家大企业选择了希赛教育。
而希赛旗下的希赛教育项目管理研究院是国家外国专家局培训中心授权的PMP考试培训机构,拥有近10名资深PMP考试培训与辅导专家,
拥有自主知识产权的辅导平台和模拟测试系统,名师实时在线解答学员提问,学员考试通过率极高。

1、光环国际

光环国际隶属于北京光环国际教育科技股份有限公司,创办于2001年,专注PMP证书培训18年,拥有5大一线城市直营分校及远程PMP学习平台,
覆盖国内98个城市、国外13个国家,超100000名PMP学员,450余家企业客户。光环国际十八年来以品质立品牌,
以服务赢口碑,是目前国内专业的项目管理培训和咨询机构,非常值得信赖。


《怪诞行为学》——换位思考

《我在精神病院抗抑郁》

/**************************************************/

《登天的感觉》

——岳晓东,这是一本相当不错的心理咨询入门书,生动而不失准确,十多年来多次再版。之所以有这个书名,据说是因为咨询能带给人一种登天般的感觉。
岳晓东博士是中国著名的心理学家,大学毕业后赴美深造,1993年获得哈佛大学心理学博士学位。他是国内唯一毕业于哈佛大学的心理学家,现在香港城市大学任教,并受聘担任南京大学、华南师大、南京师大等10余所大学的客座教授。
/**************************************************/

企业信息化管理软件有哪些?

https://www.zhihu.com/question/485314435
https://wenku.baidu.com/view/75c074e7a2c7aa00b52acfc789eb172ded6399b6.html?wkts=1681820014232&bdQuery=%E4%BC%81%E4%B8%9A%E4%BF%A1%E6%81%AF%E5%8C%96%E9%9C%80%E8%A6%81%E5%93%AA%E4%BA%9B%E8%BD%AF%E4%BB%B6

企业信息化管理软件

https://www.yishusx.com/notype/47633.html

数字化工厂需要哪些工业软件?工业软件包括哪些

https://baijiahao.baidu.com/s?id=1762480649512159439&wfr=spider&for=pc

15 个开源的工业软件

https://zhuanlan.zhihu.com/p/498989012

国内外最顶级的十款项目管理软件【2022年】

https://www.zhihu.com/tardis/bd/art/443080210

款顶级免费 IT 项目管理软件盘

https://baijiahao.baidu.com/s?id=1748831745577800546&wfr=spider&for=pc

ABP 文档

https://docs.abp.io/zh-Hans/abp

ABP开发框架前后端开发系列—(14)基于Winform的ABP快速开发框架

https://www.cnblogs.com/wuhuacong/p/11125693.html

【C#】浅谈ABP框架

https://blog.csdn.net/qq_23018459/article/details/90633189

盘点 10个 C# 开源项目

https://zhuanlan.zhihu.com/p/550419315

C#/.NET/.NET Core优秀项目框架推荐

https://www.cnblogs.com/Can-daydayup/p/16654734.html#_label3

值得推荐的.NET ORM框架

https://www.cnblogs.com/Can-daydayup/p/15911410.html

基于ASP.NET CORE MVC 3.1的钉钉企业H5微应用开发(1)–前提条件

https://www.codenong.com/cs106723141/

Winform TextBox中只能输入数字的几种常用方法(C#)

https://www.cnblogs.com/rosesmall/p/10063846.html

图标免费:

https://thenounproject.com/photos/

Apache 软件基金会分发目录

http://archive.apache.org/dist/ibatis/
https://www.apache.org/index.html#projects-list

灵活掌握asp.net中gridview控件的多种使用方法(下)

//https://www.jb51.net/article/74459.htm
//gIntro = Convert.ToString(mydrv[“家庭住址”]);
//gv.Rows[i].Cells[3].Text = SubStr(gIntro, 2);

RabbitMQ 入门系列:10、扩展内容:延时队列:延时队列插件及其有限的适用场景(系列大结局)。

https://www.cnblogs.com/cyq1162/p/16607941.html

帆软和思迈特软件哪个比较好,深度测评

https://baijiahao.baidu.com/s?id=1678820380873484365&wfr=spider&for=pc/

帆软社区首页

https://help.fanruan.com/finereport/doc-view-2460.html

实现GridView内容循环滚动

https://www.cnblogs.com/wenghaowen/p/3261569.html

LINQ 教程

https://www.nhooo.com/linq/linq-tutorial.html

http://caibaojian.com/a-programmer/
https://www.yisu.com/zixun/332478.html
http://t.zoukankan.com/loushuibazi-p-3776629.html

C# bartender打印帮助类,单个打印以及批量打印方法封装

https://blog.csdn.net/u011540323/article/details/124670591

C#调用打印机实现打印_C#教程

https://www.ab62.cn/article/14502.html

C#调用Bartender模板打印,输出图片,PDF

https://blog.csdn.net/weixin_38211198/article/details/117842617?utm_medium=distribute.pc_feed_404.none-task-blog-2defaultBlogCommendFromBaiduRate-5-117842617-blog-null.pc_404_mixedpudn&depth_1-utm_source=distribute.pc_feed_404.none-task-blog-2defaultBlogCommendFromBaiduRate-5-117842617-blog-null.pc_404_mixedpud

C# 调用CodeSoft 方法

https://blog.csdn.net/weixin_44032514/article/details/118999866?utm_medium=distribute.pc_feed_404.none-task-blog-2defaultBlogCommendFromBaiduRate-4-118999866-blog-null.pc_404_mixedpudn&depth_1-utm_source=distribute.pc_feed_404.none-task-blog-2defaultBlogCommendFromBaiduRate-4-118999866-blog-null.pc_404_mixedpud


常用甘特图控件汇总(附下载)

https://www.evget.com/article/2014/4/17/20853.html

31款第三方控件/软件实现JAVA敏捷开发,成熟开发者都在用

https://www.evget.com/article/2020/10/22/38763.htmlx

-----------------遍历查询枚举清单的方法-------------------------------------------------------------------------------------------------

if (m_appConfiguration.bEquals(processorInstance, instanceName.ToString()))
{
ServicesList t = Enum.GetValues(typeof(ServicesList))
.Cast()
.FirstOrDefault(v => v.ToString() == instanceName.ToString());

                        ServiceList(t);
                    }

-----------------枚举转换为Switch case的方法-------------------------------------------------------------------------------------------------

枚举转换为Switch case的方法:

                TASK_TYPE tte;
                if (Enum.TryParse<TASK_TYPE>(model.TASK_TYPE, out tte))
                {
                    switch (tte)
                    {
                        case TASK_TYPE.:
                            model.A = dr[""].ToString();
                            string[] arrTimeAt = itter.Split(model.A, ",");
                            for (int i = 0; i < arrTimeAt.Length; i++)
                            {
                               
                            }
                            break;

                        case TASK_TYPE.:
                            model. = dr[""].ToString();
                            break;

                        case TASK_TYPE.:
                            break;

                        default:
                            break;
                    }
                }

-----------------web中图片文字如何对齐-------------------------------------------------------------------------------------------------

5、vertical-align 数值方式的使用
如,还是上面的基本案列:如果图片高度是20px,文字font-size为22px时,默认对齐是文字的基线,那么图片会偏上2px,
这时只需要将图片向下偏移2px,就能实现对齐效果,而且vertical-align这个属性的数值型具有很好的兼容性。

.wrap {
width: 100%;
padding-top: 200px;
text-align: center;
margin: 20px auto;
font-size: 22px;
height: 40px;

    }
    .wrap img {
        width: 20px;
        vertical-align: -2px;
    }

-----------------母版页控件的引用-------------------------------------------------------------------------------------------------

使用MasterType指令获取母版页控件的引用
相对于上面的FindControl方法而言,MasterType显得很直接。通过使用MasterType,可以创建与母版页的强类型引用。
<%@ MasterType VirtualPath=“~/MasterPage/mesMaster.Master” %>
TextBox1.Text = Master.MasterClientIP.Value;

-----------------SelectedIndex-------------------------------------------------------------------------------------------------

webform dropdownlist:

ddlDataName.SelectedIndex = ddlDataName.Items.IndexOf(ddlDataName.Items.FindByValue(NSDBField.Value));

winform combox:
cmbCustomer.SelectedItem = cmbCustomer.Items.Cast() .FirstOrDefault(x => x.Row[“cusno”].ToString() == cusno);

comboBox1.SelectedItem = comboBox1.Items.Cast()
.FirstOrDefault(x => x.Value.ToString() == dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString());

displayShowblock(tb_expiry);
tb_expiry.Attributes.Add(“style”, “width:100%;”);

/*********************************************************************************************************/

----------------------------多行换行显示—css--------------------------------------------------------------------------------

<%–

--%>

###**********************************************************************************************************

https://doc.mbalib.com/view/edd311e86245b2a957b4b0b7448f1c8b.html
2022生产异常管理 —mba


###比较好的ORM微型框架以及.net mvc常识

c#基础

1.Dapper和PetaPOCO都是比较好的ORM微型框架

Dapper不跨数据库/PetaPOCO可以跨数据库

2.ab测试并发的网站/LR惠普测试的工具/aqtime测试工具(可以告诉哪行代码有问题)

###3.导航属性主要是关联两个或者多个表中的关联关系一对多等一个实体类中实现多个表的数据关联

###LINQ to SQL适合小型项目快速开发,EF和其他ORM如NHibernate可以作为大型项目的选择。
MVC只是展现层模式,对于数据层使用什么样的ORM框架、什么样的数据访问方式,都没有关系。
所以你要选择的只是数据层的解决方案,而不是MVC的最佳组合。


###/*********************** ************ | jQuery API手册 -****************************************************************/

| jQuery API手册

http://caibaojian.com/jquery/length.html
/*********************** ************ | jQuery API手册 -****************************************************************/

/*********************** jQuery API 3.5.1 速查表 -****************************************************/
###jquery流程
https://www.jq22.com/search?seo=%e6%b5%81%e7%a8%8b&PageNo=2

https://jquery.cuishifeng.cn/
/*********************** jQuery API 3.5.1 速查表 -****************************************************/
winform tabcontrol上色
https://blog.csdn.net/Scarlett2025/article/details/119028661

iMarquee --jquery插件
https://pan.baidu.com/s/1hqyF0W0?at=1629262766181

###资源:dowebok
https://www.dowebok.com/code

/*********************** resharper优化配置****************************************************/

resharper优化配置
https://www.jetbrains.com/help/resharper/2021.2/Speeding_Up_ReSharper.html#known_performance_problems
/*********************** resharper优化配置***************************************************/

private void panel1_SizeChanged(object sender, EventArgs e)
{
groupBox1.Refresh();
}

private void label1_Paint(object sender, PaintEventArgs e)
    {
        label1.BorderStyle = BorderStyle.None;

        publicFuncs.DrawBorder(e.Graphics, label1.ClientRectangle, Color.FromArgb(151,203,255), label1.Width,
            label1.Height);

publicFuncs.DrawBorder(e.Graphics, groupBox1.ClientRectangle, Color.FromArgb(217,217,217), groupBox1.Width,
groupBox1.Height,3);

    }

###BootCDN
jquery开源库Juery相关插件
https://www.bootcdn.cn/
/MES 日期******************************************************/

iMES.Ulitities.common.DateCommoncls.GetLongDateString(); //yyyyMMdd
iMES.Ulitities.common.DateCommoncls.GetDateString(); //yyyy-MM-dd
iMES.Ulitities.common.DateCommoncls.GetDateTimeString(); //yyyy-MM-dd HH:mm:ss
iMES.Ulitities.common.DateFormats.DateTimeFormat

###/CSS浏览器兼容性******************************************************/

CSS浏览器兼容性常见问题总结大全(推荐)
https://www.jb51.net/css/571918.html

http://c.biancheng.net/
语言中文网

###->–>->–>->–>->–>->–>->–>->–>->–>->–>->–>
/************************* 回调函数的实现*******************************************************************************/
web箭头字符
——−→∗

            &darr;

$(“#<%= btn_Search.ClientID %>”).trigger(“click”);

###/************************* 调函数的实现*******************************************************************************/
关于父页面调用子页面,子页面传值给父页面 回调函数的实现

StringBuilder sMsg = new StringBuilder();
sMsg.Append(“alert('” + bas=ed + “!:” + txt.Text.Trim().ToString() + “');”);
sMsg.Append(“opener.document.all.ctl00 C o n t e n t P l a c e H o l d e r 1 ContentPlaceHolder1 ContentPlaceHolder1productCatory.value = ‘’;”);
sMsg.Append(“window.opener.review();”);
sMsg.Append(“window.close();”);
ScriptManager.RegisterClientScriptBlock(Page, typeof(string), “a2”, sMsg.ToString(), true);

###/*************************(母版页)中调用body的onload事件的方法 *******************************************************************************/
protected override void Render(HtmlTextWriter writer)
{
//继承模板页的内容页加入 onload 事件
System.IO.StringWriter sw = new System.IO.StringWriter();
HtmlTextWriter htw = new HtmlTextWriter(sw);
base.Render(htw);
if (counts > 1)
{
writer.Write(sw.ToString().Replace(“<body”, “<body οnlοad=“Showize();””));
}
else
{
writer.Write(sw.ToString().Replace(“<body”, “<body”));
}

    }

https://blog.csdn.net/u010792238/article/details/22496131?spm=1035.2023.3001.6557&utm_medium=distribute.pc_relevant_bbs_down_v2.none-task-blog-2defaultOPENSEARCHRate-1.pc_relevant_bbs_down_v2_default&depth_1-utm_source=distribute.pc_relevant_bbs_down_v2.none-task-blog-2defaultOPENSEARCHRate-1.pc_relevant_bbs_down_v2_default]

###/************************* *******************************************************************************/

关于父页面调用子页面,子页面传值给父页面 回调函数的实现
https://blog.csdn.net/boenwan/article/details/81113863?utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromMachineLearnPai2%7Edefault-1.control&dist_request_id=1330144.35480.16182307862326579&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromMachineLearnPai2%7Edefault-1.control

###/页面聚焦前端******************************************************/

protected override void Render(HtmlTextWriter writer)
{
//继承模板页的内容页加入 onload 事件
System.IO.StringWriter sw = new System.IO.StringWriter();
HtmlTextWriter htw = new HtmlTextWriter(sw);
base.Render(htw);
writer.Write(sw.ToString().Replace(“<body”, “<body οnlοad=‘javascript:this.focus();’ οnblur=‘javascript:this.focus();’”));
}

###/LinkButton提交按钮*************************************************************/
UseSubmitBehavior=“false” OnClientClick=“this.value=‘正在提交’;this.disabled=true;”

        icon = "search.png";
        ButtonControls.InitialControls(btnQuery2, Session["userid"].ToString(), moduleiD, FunctionType.Search.ToString(), (int)FunctionType.Search, icon, icnPath, true);


        icon = "table_daochu.png";
        ButtonControls.InitialControls(btnExport, Session["userid"].ToString(), moduleiD, FunctionType.Export.ToString(), (int)FunctionType.Export, icon, icnPath, true);

<asp:LinkButton ID=“btnQuery” runat=“server” CssClass=“buttoncss buttoncss_a” OnClick=“”>查询 查询</asp:LinkButton>
<asp:LinkButton ID=“btnSearch” runat=“server” CssClass=“buttoncss buttoncss_a” OnClick=“”>确定 确定</asp:LinkButton>
<asp:LinkButton ID=“btnCacel” runat=“server” CssClass=“buttoncss buttoncss_a” OnClick=“”>取消 取消</asp:LinkButton>
<asp:LinkButton ID=“btnDel” runat=“server” CssClass=“buttoncss buttoncss_a” OnClick=“”>删除 删除</asp:LinkButton>
<asp:LinkButton ID=“btnSave” runat=“server” CssClass=“buttoncss buttoncss_a” OnClick=“”>提交确认 提交变更 </asp:LinkButton>

<asp:LinkButton ID=“lbtsave” CssClass=“buttoncss buttoncss_a” runat=“server” OnClick=“”>添加 添加</asp:LinkButton>

/*********************************************************************************************************/
<asp:LinkButton ID=“btnUpdate” runat=“server” CausesValidation=“True” CommandArgument=‘<%# ((GridViewRow)Container).RowIndex %>’ CommandName=“Update” Text=“<img src=…/Content/icon/save.png border=0 align=middle alt=保存 >保存”></asp:LinkButton>
 <asp:LinkButton ID=“btnCancel” runat=“server” CausesValidation=“False” CommandArgument=‘<%# ((GridViewRow)Container).RowIndex %>’ CommandName=“Cancel” Text=“<img src=…/Content/icon/cancel.gif border=0 align=middle alt=取消 >取消”></asp:LinkButton>

//固定背景属性

/*********************************************************************************************************/

background-attachment: fixed; background-repeat: no-repeat; background-position: center; background-size: cover; //图片平铺

/ *******fieldset *************

 关键信息

/*********************************************************************************************************/

SELECT obj.Name 存储过程名, sc.TEXT 存储过程内容

FROM syscomments sc
INNER JOIN sysobjects obj ON sc.Id = obj.ID
WHERE sc.TEXT LIKE ‘%’ + ‘IENT’ + ‘%’

/*********************************************************************************************************/

/*********************************************************************************************************/

//checkbox单选按钮

/ …事务ASPNET**************************************************************************///…

		TransactionOptions options = new TransactionOptions();
        options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
        options.Timeout = new TimeSpan(0, 2, 0);
        try
        {

            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options))
            {



			scope.Complete();
            }

		}
        catch (Exception ex)
        {
            throw new Exception(ex.Message);
        }

/ 只能是数字:***************************************************************************************************/

<asp:TextBox ID="txtlotqty" runat="server" Style="width: 40px" MaxLength="4" onkeyup="this.value=value.replace(/^(0+)|[^\d]+/g,'');"
										onafterpaste="this.value=value.replace(/^(0+)|[^\d]+/g,'');">50</asp:TextBox>

或者:
οnkeyup=“if(isNaN(value))execCommand(‘undo’)”
onafterpaste=“if(isNaN(value))execCommand(‘undo’)”

/*********************************************************************************************************/

/*********************************************************************************************************/

echart:

http://www.jq22.com/demo/jqueryecharts201812242223/
export2 excel
http://www.jq22.com/jquery-info21173

/*********************************************************************************************************/

/*********************************************************************************************************/

//----------datagrid—

CssClass=“datable” GridLines=“None” style=“border: 1px solid #97CBFF”>







<asp:TemplateColumn HeaderText=“序号”>



<asp:Label runat=“server”><%# (dg_I.CurrentPageIndex * dg_I.PageSize + Container.ItemIndex + 1) %>
</asp:Label>

</asp:TemplateColumn>

</asp:DataGrid>

        if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
        {
            if (e.Item.FindControl("lbtndel") != null)
            {
                icon = "delete.gif";
                base.InitControls_DataGrid((LinkButton)(e.Item.FindControl("lbtndel")), FunctionType.Delete.ToString(), (int)FunctionType.Delete, sleiD, icon, icnPath, true);

                if (((LinkButton)(e.Item.FindControl("lbtndel"))).Enabled)
                {
                    ((LinkButton)(e.Item.FindControl("lbtndel"))).Attributes.Add("onClick", "return confirm('" +teConfirm + "');");
                }
            }

 if (e.Item.FindControl("lbtnEdit") != null)
                {

}
}

if (e.Item.ItemType == ListItemType.EditItem)
{

        }

if (e.Item.ItemType == ListItemType.Footer)
{
if (e.Item.FindControl(“lbtnadd”) != null)
{

            }
        }  


    protected void lbtnedit_Click(object sender, EventArgs e)
    {

        LinkButton btnEdit = sender as LinkButton;
      

        
        cbx_UserName.Checked = true;
    
    }

/*********************************************************************************************************/

//--------------------gridview--------

AutoGenerateColumns="False"  EmptyDataText="暂无数据" ShowHeaderWhenEmpty="True"
CssClass="datable" GridLines="None"   style="border: 1px solid #97CBFF">
	   <HeaderStyle CssClass="headcss"></HeaderStyle>
                            <AlternatingRowStyle  CssClass="altrowcss"></AlternatingRowStyle>
                            <RowStyle CssClass="rowcss"></RowStyle>
                            <FooterStyle CssClass="page"></FooterStyle>
                            <PagerStyle CssClass="page"></PagerStyle>
                                 <EditRowStyle BackColor="Info" />
<PagerSettings Position="TopAndBottom" />
<Columns>

                    <asp:TemplateField ShowHeader="False">
                        <ItemTemplate>
                            <asp:LinkButton ID="btnDel" runat="server" CausesValidation="False" CommandName="DELETEBTN" Text="删除"></asp:LinkButton>
                        </ItemTemplate>
                        <HeaderStyle Width="60px" />
                    </asp:TemplateField>
		       <asp:TemplateField ShowHeader="False">
                        <ItemTemplate>
                            <asp:LinkButton ID="lbtnEdit" runat="server" CausesValidation="False" CommandName="EDITBTN" Text="编辑"></asp:LinkButton>
                        </ItemTemplate>
						   <EditItemTemplate>
                            <asp:LinkButton ID="lbtnUpdate" runat="server" CausesValidation="True" CommandName="Update" Text="保存"></asp:LinkButton>
                            &nbsp;<asp:LinkButton ID="lbtnCancel" runat="server" CausesValidation="False" CommandName="Cancel" Text="取消"></asp:LinkButton>
                        </EditItemTemplate>
                        <HeaderStyle Width="80px" />
                    </asp:TemplateField>

<asp:TemplateField HeaderText=“序号”>

<%#(Container.DataItemIndex+1).ToString()%>


</asp:TemplateField>

		</Columns>

rowDataBound

if (e.Row.RowType == DataControlRowType.DataRow || e.Row.RowType == DataControlRowType.EmptyDataRow)
{
if (e.Row.RowState == (DataControlRowState.Alternate | DataControlRowState.Normal)
|| e.Row.RowState == DataControlRowState.Normal)
{
if (e.Row.FindControl(“btnDel”) != null)
{
icon = “delete.gif”;
base.InitCon\taGrid((LinkButton)(e.Row.FindControl(“btnDel”)),
FunctionType.Delete.ToString(), (int)FunctionType.Delete, \duleiD, icon, icnPath,
true);

                    if (((LinkButton)(e.Row.FindControl("btnDel"))).Enabled)
                    {
                        ((LinkButton)(e.Row.FindControl("btnDel"))).Attributes.Add("onClick",
                            "return confirm('" + base.DeleteConfirm + "');");
                    }
                }

                if (e.Row.FindControl("lbtnEdit") != null)
                {
                    icon = "edit.gif";
                    base.InitCont\Grid((LinkButton)(e.Row.FindControl("lbtnEdit")),
                        FunctionType.Update.ToString(), (int)FunctionType.Update,\oduleiD, icon, icnPath,
                        true);

                }
            }
            else if ((e.Row.RowState == (DataControlRowState.Edit | DataControlRowState.Alternate)) || (e.Row.RowState == DataControlRowState.Edit))
            {

                DropDownList ddlstatus = (DropDownList)e.Row.FindControl("ddlStatus");
               
                
                if (e.Row.FindControl("lbtnUpdate") != null)
                {
                    icon = "save.png";
                    base.InitCo\aGrid((LinkButton) (e.Row.FindControl("lbtnUpdate")),
                        FunctionType.Update.ToString(), (int) FunctionType.Update, \uleiD, icon, icnPath,
                        true);

                }
                 
                
                if (e.Row.FindControl("lbtnCancel") != null)
                {
                    icon = "undo.png";
                    base.Init\Grid((LinkButton) (e.Row.FindControl("lbtnCancel")),
                        FunctionType.Cancel.ToString(), (int) FunctionType.Cancel, m\iD, icon, icnPath,
                        true);
                } 

    
            }

}
else if (e.Row.RowType == DataControlRowType.Footer)
{
Label lbtnAllfial = e.Row.FindControl(“lbltotalqty”) as Label;
if (lbtnAllfial != null)
{
lbtnAllfial.Text = sum.ToString();
}
}


if (e.Item.ItemType == ListItemType.EditItem)

    {
        DropDownList dropl = (DropDownList)e.Item.FindControl("DropDownList1");
        dropl.DataSource = bin\();
        dropl.DataTextField = "ssName";
        dropl.DataValueField = "sNum";
        dropl.DataBind();
    }

if (e.Row.RowIndex >= 0)
{
sum += Convert.ToDouble(e.Row.Cells[6].Text);
}
else if (e.Row.RowType == DataControlRowType.Footer)
{
e.Row.Cells[5].Text = “总薪水为:”;
e.Row.Cells[6].Text = sum.ToString();
e.Row.Cells[3].Text = “平均薪水为:”;
e.Row.Cells[4].Text = ((int)(sum / GridView1.Rows.Count)).ToString();

    }
        sonmoduleiD = getMid(rb_searchall.TabIndex, moduleiD);

protected void gvPfo_RowCommand(object sender, GridViewCommandEventArgs e)

    {
        string commandCode = e.CommandName.ToString().ToUpper();

		if (bCommands(commandCode))
        {
            //跳出执行 下面按钮执行代码
            return;
        }


        string url = string.Empty;
        int nIndex = ((GridViewRow)((LinkButton)(e.CommandSource)).Parent.Parent).RowIndex;
        switch (commandCode)
        {
          
            case "DELETE":
               
          
                break;

case “PFO”:

                break;
            case "LABEO":
               
                base.GetOpe
                break;
        }
    }

*****gridview-RowEditing ************

  protected void gvst_RowEditing(object sender, GridViewEditEventArgs e)
    {
        gvPara_test.EditIndex = e.NewEditIndex;
        //当前编辑行背景色高亮
        this.gvPara_test.EditRowStyle.BackColor = System.Drawing.Color.FromArgb(237, 211, 237);

        Datagrid_bind(();

    }

protected void gvPara_test_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
{
gvPara_test.EditIndex = -1;
this.gvPara_test.EditRowStyle.BackColor = System.Drawing.Color.FromArgb(255, 255, 255);
Datagrid_bind();
}

protected void gvest_RowUpdating(object sender, GridViewUpdateEventArgs e)

    {
        try
        {

            int index = gvPara_test.EditIndex;
            GridViewRow row = gvPara_test.Rows[index];
            HiddenField hidprarpID = (HiddenField)row.FindControl("hrarpID");  

            if (string.IsNullOrEmpty(paras_name.Trim()))
            {
                base.GetAlarm("不能为空");
                this.gvPt.EditIndex = index;
                
                return;
            }

            if (!duplicate(paras_id, p\ame, "", Configns))
            {

                
                
                
                InsertU();

                this.gvPa.EditIndex = -1;
                 
            }
            else
            {
                base.GetAlarm(": 请重新输入!");
                this.gvPest.EditIndex = index;

        }
        catch (Exception ex)
        {
           
        GetAlarm("发生错误");
            this.gvPt.EditIndex = -1;
           
        }


    }

protected void gvPat_RowDeleting(object sender, GridViewDeleteEventArgs e)

    {
        if (this.gvPara_test.EditIndex != e.RowIndex)
        {
            HiddenField hiID = thPara_tet.Rows[e.RowIndex].FindControl("hiID ") as HiddenField;
            
            int rowaffect =  delTes(pid, SConns.ToString());
            this.gvPara_test.EditIndex = -1;
        }
        else
        {
           
            this.gvPara_test.EditIndex = e.RowIndex;
        }

    }

/*********************************************************************************************************/

//Gridview分页(1):每页显示选择项—推荐使用------------------------------

AllowPaging=“True”
OnPageIndexChanging=“gd2_PageIndexChanging”>

  <PagerTemplate>
                    &nbsp;当前是第:<asp:Label ID="LabelCurrentPage" runat="server" Text="<%# ((GridView)Container.NamingContainer).PageIndex + 1 %>"></asp:Label>
                    页/共<asp:Label ID="LabelPageCount" runat="server" Text="<%# ((GridView)Container.NamingContainer).PageCount %>"></asp:Label>页
                    &nbsp;<asp:LinkButton ID="LinkButtonFirstPage" runat="server" CommandArgument="First" CommandName="Page" Visible='<%#((GridView)Container.NamingContainer).PageIndex != 0 %>'>|&lt;首页</asp:LinkButton>
                    &nbsp;<asp:LinkButton ID="LinkButtonPreviousPage" runat="server" CommandArgument="Prev" CommandName="Page" Visible='<%# ((GridView)Container.NamingContainer).PageIndex != 0 %>'>&lt;&lt;上一页</asp:LinkButton>
                    &nbsp;<asp:LinkButton ID="LinkButtonNextPage" runat="server" CommandArgument="Next" CommandName="Page" Visible='<%# ((GridView)Container.NamingContainer).PageIndex != ((GridView)Container.NamingContainer).PageCount - 1 %>'>下一页&gt;&gt;</asp:LinkButton>
                    &nbsp;<asp:LinkButton ID="LinkButtonLastPage" runat="server" CommandArgument="Last" CommandName="Page" Visible='<%# ((GridView)Container.NamingContainer).PageIndex != ((GridView)Container.NamingContainer).PageCount - 1 %>'>尾页&gt;|</asp:LinkButton>
                    &nbsp;转到第<asp:TextBox ID="txtNewPageIndex" runat="server" Width="20px" Text='<%# ((GridView)Container.Parent.Parent).PageIndex + 1 %>' />页
                    &nbsp;<asp:LinkButton ID="btnGo" runat="server" CausesValidation="False" CommandArgument="-2" CommandName="Page" Text="GO" />&nbsp;|

 每页显示<asp:DropDownList ID=“ddlPagesize” runat=“server” AutoPostBack=“True” OnSelectedIndexChanged=“ddlPagesize_SelectedIndexChanged”>
<asp:ListItem Value=“5”>5</asp:ListItem>
<asp:ListItem Value=“10” Selected=“True”>10</asp:ListItem>
<asp:ListItem Value=“20”>20</asp:ListItem>
<asp:ListItem Value=“50”>50</asp:ListItem>
</asp:DropDownList>条数据


分页显示按钮事件

  protected void gd2_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        #region 

        // 得到该控件
        GridView theGrid = sender as GridView;
        int newPageIndex = 0;
        if (e.NewPageIndex == -3)
        {
            TextBox txtNewPageIndex = null;
            GridViewRow pagerRow = theGrid.BottomPagerRow;

            if (pagerRow != null)
            {
                txtNewPageIndex = pagerRow.FindControl("txtNewPageIndex") as TextBox;
            }

            if (txtNewPageIndex != null)
            {
                newPageIndex = int.Parse(txtNewPageIndex.Text) - 1;
            }
        }
        else
        {

            newPageIndex = e.NewPageIndex;
        }

        newPageIndex = newPageIndex < 0 ? 0 : newPageIndex;
        newPageIndex = newPageIndex >= theGrid.PageCount ? theGrid.PageCount - 1 : newPageIndex;
        theGrid.PageIndex = newPageIndex;

        //重新绑定

        string job = iMES.Ulitities.common.mwh.StringFormat.StringFromatAll(txtwo.Text.Trim());
        string Orderby = " SN  ";
        BindGridView(job, Orderby);

        #endregion

    }

protected void ddlPagesize_SelectedIndexChanged(object sender, EventArgs e)

    {
        try
        {
            string val = string.Empty;
            object vsender = sender;

            DropDownList pagesizes = (DropDownList)vsender as DropDownList;
            if ((pagesizes.NamingContainer as GridViewRow).RowType == DataControlRowType.Pager)
            {
                DropDownList ddlpagesizes = (DropDownList)(pagesizes.NamingContainer as GridViewRow).FindControl("ddlPagesize");
                TextBox txtpindex = (TextBox)(pagesizes.NamingContainer as GridViewRow).Cells[0].FindControl("txtNewPageIndex");
                gvlist.PageIndex = int.Parse(txtpindex.Text) - 1;
                val = ddlpagesizes.SelectedItem.Text;
            }


            int pSize = 1;

            int.TryParse(val, out pSize);

            if (pSize > 0)
            {

                this.gvlist.PageSize = pSize;
                ViewState["pagesize"] = pSize;
                if (chkShow.Checked == true)
                {
                    binddgTodo("1", txtDocmentNo.Text.Trim());
                }
                else
                {
                    binddgTodo("0", txtDocmentNo.Text.Trim());
                }
            }

            //header:



        }
        catch (Exception exception)
        {
            throw new Exception(exception.Message.ToString());
        }

    }

/*********************************************************************************************************/

//Gridview分页(2)–固定显示没有条目数量–推荐使用-------------------------------

AllowPaging=“True” OnPageIndexChanging=“gvrules_PageIndexChanging” PageSize=“10”>

 <PagerTemplate>
            &nbsp;当前是第:<asp:Label ID="LabelCurrentPage" runat="server" Text="<%# ((GridView)Container.NamingContainer).PageIndex + 1 %>"></asp:Label>
            页/共<asp:Label ID="LabelPageCount" runat="server" Text="<%# ((GridView)Container.NamingContainer).PageCount %>"></asp:Label>页
            &nbsp;<asp:LinkButton ID="LinkButtonFirstPage" CausesValidation="False"  runat="server" CommandArgument="First" CommandName="Page" Visible='<%#((GridView)Container.NamingContainer).PageIndex != 0 %>'>|&lt;首页</asp:LinkButton>
            &nbsp;<asp:LinkButton ID="LinkButtonPreviousPage" CausesValidation="False"  runat="server" CommandArgument="Prev" CommandName="Page" Visible='<%# ((GridView)Container.NamingContainer).PageIndex != 0 %>'>&lt;&lt;上一页</asp:LinkButton>
            &nbsp;<asp:LinkButton ID="LinkButtonNextPage" CausesValidation="False"  runat="server" CommandArgument="Next" CommandName="Page" Visible='<%# ((GridView)Container.NamingContainer).PageIndex != ((GridView)Container.NamingContainer).PageCount - 1 %>'>下一页&gt;&gt;</asp:LinkButton>
            &nbsp;<asp:LinkButton ID="LinkButtonLastPage" CausesValidation="False"  runat="server" CommandArgument="Last" CommandName="Page" Visible='<%# ((GridView)Container.NamingContainer).PageIndex != ((GridView)Container.NamingContainer).PageCount - 1 %>'>尾页&gt;|</asp:LinkButton>
            &nbsp;转到第<asp:TextBox ID="txtNewPageIndex" runat="server" Width="20px" Text='<%# ((GridView)Container.Parent.Parent).PageIndex + 1 %>' />页
            &nbsp;<asp:LinkButton ID="btnGo" runat="server" CausesValidation="False" CommandArgument="-2" CommandName="Page" Text="GO" />
        </PagerTemplate>

</asp:GridView>

protected void gvrules_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        #region 方法3
        // 得到该控件
        GridView theGrid = sender as GridView;
        int newPageIndex = 0;
        if (e.NewPageIndex == -3)
        {
            //点击了Go按钮
            TextBox txtNewPageIndex = null;

            //获取分页块可以使用BottomPagerRow 或者TopPagerRow,当然还增加了HeaderRow和FooterRow
            GridViewRow pagerRow = theGrid.BottomPagerRow;

            if (pagerRow != null)
            {
                //得到text控件
                txtNewPageIndex = pagerRow.FindControl("txtNewPageIndex") as TextBox;
            }

            if (txtNewPageIndex != null)
            {
                //得到索引
                newPageIndex = int.Parse(txtNewPageIndex.Text) - 1;
            }
        }
        else
        {
            //点击了其他的按钮
            newPageIndex = e.NewPageIndex;
        }

        //防止新索引溢出
        newPageIndex = newPageIndex < 0 ? 0 : newPageIndex;
        newPageIndex = newPageIndex >= theGrid.PageCount ? theGrid.PageCount - 1 : newPageIndex;
        //得到新的值
        theGrid.PageIndex = newPageIndex;

        //重新绑定
        bingCountRules();

        #endregion

    } 

/gridview 移动行【前台、后台】*******************/

Grdiview的编辑保存取消按钮

      <asp:CommandField ShowEditButton="true"
                            EditText="<img border=0 src=../Content/icon/edit.gif align=middle alt=编辑/>编辑"
                            UpdateText="保存"
                            CancelText="取消">
                            <HeaderStyle Width="60px" HorizontalAlign="Center" />
                        </asp:CommandField>

<asp:LinkButton runat=“server” CommandName=“Delete” ID=“lbtndel”>删除删除</asp:LinkButton>

<asp:HyperLink ID=“HyperLink1” runat=“server” Target=“_blank” NavigateUrl=‘<%# Eval(“ooo”,“001.aspx?wo={0}”) %>’ ImageUrl=“…/Content/icon/table.png” BorderWidth=“0px” BorderStyle=“None” Text=“详细”></asp:HyperLink>

/----end–结束GridView-web form 结束----end–************************************************************************************/

/*********************************************************************************************************/

  string sPath =   ConfigSettingsManage.iMESDefaultFilePath + "\\tmpimage";

            if (!Directory.Exists(sPath))
                Directory.CreateDirectory(sPath);

            foreach (string d in Directory.GetFileSystemEntries(sPath))
            {
                File.Delete(d);//直接删除其中的文件
            }

/*********************************************************************************************************/

CssClass=“datablemove” GridLines=“None” style=“border: 1px solid #97CBFF”>

                        <HeaderStyle CssClass="headcss"></HeaderStyle>
                        <AlternatingItemStyle CssClass="altrowcss"></AlternatingItemStyle>
                        <ItemStyle CssClass="rowcss"></ItemStyle>
                        <FooterStyle CssClass="page"></FooterStyle>
                        <PagerStyle CssClass="page"></PagerStyle>



    revnow = mi.getPNOptionRev2(pn);

/*********************************************************************************************************/

//C# Winform DataGridView*****************************************************/

if (dgvCust.Columns[e.ColumnIndex] is DataGridViewButtonColumn && e.RowIndex > -1)
{
int rows = dgvCust.CurrentRow.Index; //得到当前行的索引
string id = dgvCust.Rows[rows].Cells[0].Value.ToString(); //得到表的主键ID,就是上表中的userid
//gdEdit
if (e.ColumnIndex == this.dgvCust.Columns[“gdEdit”].Index)
{

            }
            //gdDelete
            else if (e.ColumnIndex == this.dgvCust.Columns["gdDelete"].Index)
            {
                //判断列索引是不是删除按钮
                if (id != null && id != "" &&
                    MessageBox.Show("您确定要删除吗?", "重要提示!", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation) ==
                    System.Windows.Forms.DialogResult.OK)
                {

                }

            }

###            //获取当前被点击的单元格
            //DataGridViewButtonCell vCell = (DataGridViewButtonCell)dgvCust.CurrentCell;
            //if (vCell.Tag == null)
            //{
            //    vCell.Value = "停用";
            //    vCell.Tag = true;
            //}

        }

/*********************************************************************************************************/

private void dgViist_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)

    {
        SolidBrush brushOne = new SolidBrush(Color.Blue);//定义一个颜色为红色的画刷
        //绘制行号
        e.Graphics.DrawString(Convert.ToString(e.RowIndex + 1, System.Globalization.CultureInfo.CurrentUICulture), e.InheritedRowStyle.Font, brushOne, e.RowBounds.Location.X + 20, e.RowBounds.Location.Y + 4);

    }

/*********************************************************************************************************/

 ###    #region 合并列相同的内容- Winform
    private void dataGridView1_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)//绘制单元格事件
    {
        // 对第1列相同单元格进行合并     
        if (e.ColumnIndex == 2 && e.RowIndex != -1 || e.ColumnIndex == 3 && e.RowIndex != -1)
        {
            Brush datagridBrush = new SolidBrush(dataGridView1.GridColor);
            SolidBrush groupLineBrush = new SolidBrush(e.CellStyle.BackColor);
            using (Pen datagridLinePen = new Pen(datagridBrush))
            {
                // 清除单元格
                e.Graphics.FillRectangle(groupLineBrush, e.CellBounds);
                if (e.RowIndex < dataGridView1.Rows.Count - 1 && dataGridView1.Rows[e.RowIndex + 1].Cells[e.ColumnIndex].Value != null && dataGridView1.Rows[e.RowIndex + 1].Cells[e.ColumnIndex].Value.ToString() != e.Value.ToString())
                {
                    //绘制底边线
                    e.Graphics.DrawLine(datagridLinePen, e.CellBounds.Left, e.CellBounds.Bottom - 1, e.CellBounds.Right, e.CellBounds.Bottom - 1);
                    // 画右边线
                    e.Graphics.DrawLine(datagridLinePen, e.CellBounds.Right - 1, e.CellBounds.Top, e.CellBounds.Right - 1, e.CellBounds.Bottom);
                }
                else
                {
                    // 画右边线
                    e.Graphics.DrawLine(datagridLinePen, e.CellBounds.Right - 1, e.CellBounds.Top, e.CellBounds.Right - 1, e.CellBounds.Bottom);
                }
                //对最后一条记录只画底边线
                if (e.RowIndex == dataGridView1.Rows.Count - 1)
                {
                    //绘制底边线
                    e.Graphics.DrawLine(datagridLinePen, e.CellBounds.Left, e.CellBounds.Bottom - 1, e.CellBounds.Right, e.CellBounds.Bottom - 1);
                }
                // 填写单元格内容,相同的内容的单元格只填写第一个                        
                if (e.Value != null)
                {
                    if (!(e.RowIndex > 0 && dataGridView1.Rows[e.RowIndex - 1].Cells[e.ColumnIndex].Value.ToString() == e.Value.ToString()))
                    {
                        //绘制单元格内容
                        e.Graphics.DrawString(e.Value.ToString(), e.CellStyle.Font, Brushes.Black, e.CellBounds.X + 2, e.CellBounds.Y + 5, StringFormat.GenericDefault);
                    }
                }
                e.Handled = true;
            }
        }
    }

/**************************************控制只能打开一个页面 *******************************************************************/

        #region 创建cookies,控制只能打开一个
        if (Request.Cookies[this.Operator] != null)
        {
            HttpCookie mycookies = Request.Cookies[this.Operator];
            if (mycookies.Values[moduleid.Value.Trim()] == null)
            {
                mycookies.Values.Add(moduleid.Value.Trim(), moduleid.Value.Trim());
            }
            Response.Cookies.Add(mycookies);
        }
        else
        {
            HttpCookie mycookies = new HttpCookie(this.Operator, this.Operator);
            mycookies.Values[moduleid.Value.Trim()] = moduleid.Value.Trim();
            mycookies.Expires = DateTime.Now.AddMinutes(1);
            Response.Cookies.Add(mycookies);
        }
        #endregion

/*********************************************************************************************************/

输入数字-winform keypess==========================

private void OnlyNumber(object sender, KeyPressEventArgs e)
	{
		if (e.KeyChar == 0x20) e.KeyChar = (char)0;  //禁止空格键  
		if ((e.KeyChar == 0x2D) && (((TextBox)sender).Text.Length == 0)) return;   //处理负数  
		if (e.KeyChar > 0x20)
		{
			try
			{
				double.Parse(((TextBox)sender).Text + e.KeyChar.ToString());
			}
			catch
			{
				e.KeyChar = (char)0;   //处理非法字符  
			}
		}
	}

/*********************************************************************************************************/

–去除特殊字符,只留0-9,a-z,A-Z

declare @teststr varchar(100)
set @teststr=‘test #123^we’
while patindex(‘%[^0-9a-zA-Z]%’,@teststr)>0
SET @teststr=STUFF(@teststr, patindex(‘%[^0-9a-zA-Z]%’,@teststr),1,‘’)
SELECT @teststr

/*********************************************************************************************************/

/*********************************************************************************************************/

---------------------------Asp.net控制TextBox只能输入数字------------

在Asp.net开发中,为了确保数据的正确性,经常要对用户输入的内容进行验证,比如说用户只能输入数字,不能输入中文和英文,这如何实现呢?下面我们来看看。
实现过程,在TextBox控件中加两个属性事件:
<asp:TextBox ID=“txtName” runat=“server” Width=“175px” style=“ime-mode:disabled” οnkeypress=“if (event.keyCode<48 || event.keyCode>57) event.returnValue=false;”></asp:TextBox>

键盘按下去时检查按下的是不是0—9,如果不是的话,不将当前的输入放入文本框中。

说明: 此方法控制TextBox只输入数字:0—9,提供一种思路;style属性控制中文的输入;onkeypress属性控制只能输入数字,不能输入小数点和英文。

/*********************************************************************************************************/

禁止粘帖:οnpaste=“return false”

禁用输入法:style=“ime-mode:disabled”
输入小数点:event.keyCode=46

ime-mode CSS属性

语法:
ime-mode : auto | active | inactive | disabled

参数:
auto : 不影响IME的状态。与不指定ime-mode属性时相同
active : 指定所有使用IME输入的字符。即激活本地语言输入法。用户仍可以撤销激活IME
inactive : 指定所有不使用IME输入的字符。即激活非本地语言。用户仍可以撤销激活IME
disabled : 完全禁用IME。对于有焦点的控件(如输入框),用户不可以激活IME
设置或检索是否允许用户激活输入中文,韩文,日文等的输入法(IME)状态。对应的脚本特性为imeMode。

举例:
οnkeyup="this.value=value.replace(/(0+)|[\d]+/g,‘’) " onafterpaste="this.value=value.replace(/(0+)|[\d]+/g,‘’) "
a、只能输入数字和小数点:

<asp:TextBox ID=“txtName” runat=“server” Width=“175px” style=“ime-mode:disabled” οnkeypress=“if ((event.keyCode<48 || event.keyCode>57) && event.keyCode!=46) event.returnValue=false;”></asp:TextBox>

b、只能输入英文和数字包括小数点:

<asp:TextBox ID=“txtName” runat=“server” Width=“175px” style=“ime-mode:disabled” ></asp:TextBox>

c、只能输入英文和数字不包括小数点:

<asp:TextBox ID=“txtName” runat=“server” Width=“175px” style=“ime-mode:disabled” οnkeypress=“if ((event.keyCode<48 || event.keyCode>57) && event.keyCode==46) event.returnValue=false;”></asp:TextBox>

这里需要注意的是:这样除了小数点不能输入外,其他符号能够输入了。

d、只能输入小数与数字:

<asp:textbox id=“TextBox1” οnkeyup=“if(isNaN(value))execCommand(‘undo’)” runat=“server”
Width=“80px” onafterpaste=“if(isNaN(value))execCommand(‘undo’)”></asp:textbox>
其实服务器控件也能加上onkeydown与up等事件的,这样就行了,不过只能输入小数与数字。

此时限制用户可输入的内容限制为英文字母和数字

以上方法实现了对TextBox输入内容的控制,你也可以举一反三,通过别的方式来实现。

补充:
1、取消按钮按下时的虚线框
在input里添加属性值 hideFocus 或者 HideFocus=true
2、只读文本框内容
在input里添加属性值 readonly
3、防止退后清空的TEXT文档(可把style内容做做为类引用)

4、ENTER键可以让光标移到下一个输入框

5、只能为中文(有闪动)
利用Ascii码的范围进行判断
6、只能为数字(有闪动)
<input οnkeyup="value=value.replace(/[^\d]/g,‘’) "onbeforepaste=“clipboardData.setData(‘text’,clipboardData.getData(‘text’).replace(/[^\d]/g,‘’))”>利用Ascii码的范围进行判断
7、只能为数字(无闪动)
利用Ascii码的范围进行判断
8、只能输入英文和数字(有闪动)
<input οnkeyup="value=value.replace(/[\W]/g,‘’) "onbeforepaste=“clipboardData.setData(‘text’,clipboardData.getData(‘text’).replace(/[^\d]/g,‘’))”>利用js的正则表达式进行验证
9、屏蔽输入法

10、只能输入 数字,小数点,减号(-) 字符(无闪动)
利用Ascii码的范围进行判断
11、只能输入两位小数,三位小数(有闪动)
利用js的正则表达式进行验证。

---------------------------结束:Asp.net控制TextBox只能输入数字------------------------------------------------------------------------------

/资料链接*******************************************************************************/

https://www.html5tricks.com/demo/16-css3-animated-buttons/index.html
https://www.html5tricks.com/demo/vue-js-flow-chart/index.html
https://www.html5tricks.com/demo/js-passwd-generator/index.html
https://www.html5tricks.com/demo/vuejs-sticky-sort-table/index.html
https://www.html5tricks.com/demo/echarts-data-graphic/index.html
https://www.html5tricks.com/demo/flexbox-responsive-honeycomb/index.html
https://www.html5tricks.com/demo/html5-canvas-color-loading/index.html
登录界面
https://www.html5tricks.com/demo/css3-login-reg-form/index.html
陨石火球
https://www.html5tricks.com/demo/html5-canvas-toon-fireball/index.html
樱花飞舞
https://www.html5tricks.com/demo/html5-webgl-sakura-animation/index.html
纯CSS3实现苹果设备 iPhone iPad iMac及iWatch
https://www.html5tricks.com/css3-iphone-ipad-imac-iwatch.html

https://www.html5tricks.com/category/html5-demo/page/5
/*********************************************************************************************************/

C#文件断点续传实现方法

https://www.jb51.net/article/71397.htm

C# 分段读/写文件(可实现断点续传)

https://blog.csdn.net/jayzai/article/details/83000687

.net 实现上传文件分割,断点续传上传文件

https://blog.csdn.net/weixin_30343157/article/details/96756267

c#文件下载示例的4种方法分享

https://www.zhangshengrong.com/p/noXQLZwNG6/
/*********************************************************************************************************/

利用js去除打印时的页眉页脚

https://www.cnblogs.com/zhangronghua/archive/2008/07/30/1256343.html

/

CSS3+jQuery实现时钟插件

https://www.cnblogs.com/roucheng/p/css3clock.html

/

给XMLHttpRequest设置超时时间
https://www.cnblogs.com/zhangronghua/archive/2008/07/14/1242662.html
/

【转】超漂亮的zDialog弹出框效果(兼容主流浏览器)

https://blog.csdn.net/hundan_520520/article/details/72770201
/

CodeSmith 7.01破解下载

https://www.cnblogs.com/jx270/p/4113335.html

/

asp.net单文件带进度条上传的解决方案

https://www.cnblogs.com/jx270/p/4114376.html

http://www.zyiz.net/tech/detail-51608.html
https://www.haolizi.net/example/view_208.html

jQuery插件之ajaxFileUpload-可异步处理

http://www.121down.com/soft/softview-63881.html
https://www.cnblogs.com/kissdodog/archive/2012/12/15/2819025.html

文件上传----jQuery插件之ajaxFileUpload

https://blog.csdn.net/llxinlan/article/details/79047006

/*********************************************************************************************************/

excel转pdf,itextpdf转换excel

https://www.cnblogs.com/liran123/p/11790833.html

C#将Excel转为PDF,添加引用iTextSharp

https://blog.csdn.net/a837584708/article/details/106758820/

在ASP.NET中创建PDF-iTextSharp起步

https://www.cnblogs.com/CareySon/archive/2011/11/02/2233174.html
http://www.mikesdotnetting.com/Article/80/Create-PDFs-in-ASP.NET-getting-started-with-iTextSharp

将方法写入OnInit中,这样刷新页面的话,控件就一直在了

<asp:PlaceHolder id=“Place” runat=“server”/> //动态创建的Table放入PlaceHolder容器中
protected override void OnInit(EventArgs e)
{
CreateControl(pmburhWorkList);
}
http://blog.sina.com.cn/s/blog_a5e6279e01016hqw.html
/*********************************************************************************************************/

/H5超炫按钮:*********************************************************************************/

https://codepen.io/xboxyan/pen/mdyXXPp
https://codepen.io/xboxyan/pen/oNgEEdG
https://codepen.io/airen/pen/JBJwWB

/jquery 选择器,模糊匹配 :*********************************************************************************/

按姓名匹配
1,name前缀为aa的所有div的jquery对象
$(“div[name^=‘aa’]”);
2,name后缀为aa的所有div的jquery对象
( " d i v [ n a m e ("div[name ("div[name=‘aa’]");
3,name中包含aa的所有div的jquery对象
$(“div[id*=‘aa’]”);

以上返回的都是jquery的集合对象,因此都可以用 .each(function(i){ }); 进行遍历

下面的格式可用于集合,也可以用于匹配单个jquery对象
$(“tag:type[tagattribute=‘xx’]”);
例如:
$(“input:text[name=‘xx’]”)

[属性名称] 匹配包含给定属性的元素
[att=value] 匹配包含给定属性的元素
[att*=value] 模糊匹配
[att!=value] 不能是这个值
[att$=value] 结尾是这个值
[att^=value] 开头是这个值
[att1][att2][att3]… 匹配多个属性条件中的一个

/正则表达式:*********************************************************************************/

一、校验数字的表达式
数字:1$
n位的数字:^\d{n}$
至少n位的数字:^\d{n,}$
m-n位的数字:^\d{m,n}$
零和非零开头的数字:^(0|[1-9][0-9]
)$
非零开头的最多带两位小数的数字:^([1-9][0-9])+(.[0-9]{1,2})?$
带1-2位小数的正数或负数:^(-)?\d+(.\d{1,2})$
正数、负数、和小数:^(-|+)?\d+(.\d+)?$
有两位小数的正实数:2+(.[0-9]{2})?$
有1~3位小数的正实数:3+(.[0-9]{1,3})?$
非零的正整数:4\d
$ 或 ^([1-9][0-9]){1,3}$ 或 ^+?[1-9][0-9]$
非零的负整数:^-[1-9][]0-9"$ 或 ^-[1-9]\d$
非负整数:^\d+$ 或 5\d*|0$
非正整数:^-[1-9]\d*|0$ 或 ^((-\d+)|(0+))$
非负浮点数:^\d+(.\d+)?$ 或 6\d*.\d*|0.\d*[1-9]\d*|0?.0+|0$
非正浮点数:^((-\d+(.\d+)?)|(0+(.0+)?))$ 或 ^(-([1-9]\d*.\d*|0.\d*[1-9]\d*))|0?.0+|0$
正浮点数:7\d*.\d*|0.\d*[1-9]\d*$ 或 ^(([0-9]+.[0-9][1-9][0-9])|([0-9][1-9][0-9].[0-9]+)|([0-9][1-9][0-9]))$
负浮点数:^-([1-9]\d*.\d*|0.\d*[1-9]\d*)$ 或 ^(-(([0-9]+.[0-9][1-9][0-9])|([0-9][1-9][0-9].[0-9]+)|([0-9][1-9][0-9])))$
浮点数:^(-?\d+)(.\d+)?$ 或 ^-?([1-9]\d*.\d*|0.\d*[1-9]\d*|0?.0+|0)$
校验字符的表达式
汉字:8{0,}$
英文和数字:9+$ 或 10{4,40}$
长度为3-20的所有字符:^.{3,20}$
由26个英文字母组成的字符串:11+$
由26个大写英文字母组成的字符串:12+$
由26个小写英文字母组成的字符串:13+$
由数字和26个英文字母组成的字符串:14+$
由数字、26个英文字母或者下划线组成的字符串:^\w+$ 或 ^\w{3,20}$
中文、英文、数字包括下划线:15+$
中文、英文、数字但不包括下划线等符号:16+$ 或 17{2,20}$
可以输入含有^%&',;=?KaTeX parse error: Expected group after '^' at position 8: \"等字符:[^̲%&',;=?\x22]+
禁止输入含有的字符:[^\x22]+
三、特殊需求表达式
Email地址:^\w+([-+.]\w+)@\w+([-.]\w+).\w+([-.]\w+)$
域名:[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+.?
InternetURL:[a-zA-z]+://[^\s]
或 ^http://([\w-]+.)+[\w-]+(/[\w-./?%&=])?$
手机号码:^(13[0-9]|14[5|7]|15[0|1|2|3|4|5|6|7|8|9]|18[0|1|2|3|5|6|7|8|9])\d{8}$
电话号码(“XXX-XXXXXXX”、“XXXX-XXXXXXXX”、“XXX-XXXXXXX”、“XXX-XXXXXXXX”、"XXXXXXX"和"XXXXXXXX):^((\d{3,4}-)|\d{3.4}-)?\d{7,8}$
国内电话号码(0511-4405222、021-87888822):\d{3}-\d{8}|\d{4}-\d{7}
电话号码正则表达式(支持手机号码,3-4位区号,7-8位直播号码,1-4位分机号): ((\d{11})|^((\d{7,8})|(\d{4}|\d{3})-(\d{7,8})|(\d{4}|\d{3})-(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1})|(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1}))KaTeX parse error: Undefined control sequence: \d at position 40: …验位,可能为数字或字符X:(^\̲d̲{15})|(^\d{18}KaTeX parse error: Undefined control sequence: \d at position 5: )|(^\̲d̲{17}(\d|X|x))
帐号是否合法(字母开头,允许5-16字节,允许字母数字下划线):18[a-zA-Z0-9_]{4,15}$
密码(以字母开头,长度在6~18之间,只能包含字母、数字和下划线):19\w{5,17}$
强密码(必须包含大小写字母和数字的组合,不能使用特殊字符,长度在 8-10 之间):^(?=.
\d)(?=.[a-z])(?=.[A-Z])[a-zA-Z0-9]{8,10}$
强密码(必须包含大小写字母和数字的组合,可以使用特殊字符,长度在8-10之间):^(?=.\d)(?=.[a-z])(?=.[A-Z]).{8,10}$
日期格式:^\d{4}-\d{1,2}-\d{1,2}
一年的12个月(01~09和1~12):^(0?[1-9]|1[0-2])$
一个月的31天(01~09和1~31):^((0?[1-9])|((1|2)[0-9])|30|31)$
钱的输入格式:
有四种钱的表示形式我们可以接受:“10000.00” 和 “10,000.00”, 和没有 “分” 的 “10000” 和 “10,000”:20[0-9]
$
这表示任意一个不以0开头的数字,但是,这也意味着一个字符"0"不通过,所以我们采用下面的形式:^(0|[1-9][0-9])$
一个0或者一个不以0开头的数字.我们还可以允许开头有一个负号:^(0|-?[1-9][0-9]
)$
这表示一个0或者一个可能为负的开头不为0的数字.让用户以0开头好了.把负号的也去掉,因为钱总不能是负的吧。下面我们要加的是说明可能的小数部分:21+(.[0-9]+)?$
必须说明的是,小数点后面至少应该有1位数,所以"10.“是不通过的,但是 “10” 和 “10.2” 是通过的:22+(.[0-9]{2})?$
这样我们规定小数点后面必须有两位,如果你认为太苛刻了,可以这样:23+(.[0-9]{1,2})?$
这样就允许用户只写一位小数.下面我们该考虑数字中的逗号了,我们可以这样:24{1,3}(,[0-9]{3})(.[0-9]{1,2})?$
1到3个数字,后面跟着任意个 逗号+3个数字,逗号成为可选,而不是必须:^([0-9]+|[0-9]{1,3}(,[0-9]{3})
)(.[0-9]{1,2})?$
备注:这就是最终结果了,别忘了”+“可以用”"替代如果你觉得空字符串也可以接受的话(奇怪,为什么?)最后,别忘了在用函数时去掉去掉那个反斜杠,一般的错误都在这里
xml文件:^([a-zA-Z]±?)+[a-zA-Z0-9]+\.[x|X][m|M][l|L]$
中文字符的正则表达式:[\u4e00-\u9fa5]
双字节字符:[^\x00-\xff] (包括汉字在内,可以用来计算字符串的长度(一个双字节字符长度计2,ASCII字符计1))
空白行的正则表达式:\n\s
\r (可以用来删除空白行)
HTML标记的正则表达式:<(\S*?)[^>]>.?|<.? /> ( 首尾空白字符的正则表达式:^\s|\s*KaTeX parse error: Undefined control sequence: \s at position 4: 或(^\̲s̲*)|(\s*) (可以用来删除行首行尾的空白字符(包括空格、制表符、换页符等等),非常有用的表达式)
腾讯QQ号:[1-9][0-9]{4,} (腾讯QQ号从10000开始)
中国邮政编码:[1-9]\d{5}(?!\d) (中国邮政编码为6位数字)
IPv4地址:((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})(.((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})){3}


/**

* 检测时间是否符合格式

  • @param {value} timevalue
    */
    function checkTime(timevalue){

    var regTime = /^([0-2][0-9])😦[0-5][0-9])😦[0-5][0-9])$/;
    var result = false;
    if (regTime.test(timevalue)) {
    if ((parseInt(RegExp.$1) < 24) && (parseInt(RegExp.$2) < 60) && (parseInt(RegExp.$3) < 60)) {
    result = true;
    }
    }
    if (result) {

    }else {
    alert(“时间格式错误”);
    return false;
    }
    return result;
    }


  1. 0-9 ↩︎

  2. 0-9 ↩︎

  3. 0-9 ↩︎

  4. 1-9 ↩︎

  5. 1-9 ↩︎

  6. 1-9 ↩︎

  7. 1-9 ↩︎

  8. \u4e00-\u9fa5 ↩︎

  9. A-Za-z0-9 ↩︎

  10. A-Za-z0-9 ↩︎

  11. A-Za-z ↩︎

  12. A-Z ↩︎

  13. a-z ↩︎

  14. A-Za-z0-9 ↩︎

  15. \u4E00-\u9FA5A-Za-z0-9_ ↩︎

  16. \u4E00-\u9FA5A-Za-z0-9 ↩︎

  17. \u4E00-\u9FA5A-Za-z0-9 ↩︎

  18. a-zA-Z ↩︎

  19. a-zA-Z ↩︎

  20. 1-9 ↩︎

  21. 0-9 ↩︎

  22. 0-9 ↩︎

  23. 0-9 ↩︎

  24. 0-9 ↩︎

  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值