惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

大猫的无限游戏
大猫的无限游戏
H
Hackread – Cybersecurity News, Data Breaches, AI and More
博客园_首页
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
D
Docker
酷 壳 – CoolShell
酷 壳 – CoolShell
宝玉的分享
宝玉的分享
Martin Fowler
Martin Fowler
美团技术团队
量子位
M
MIT News - Artificial intelligence
Apple Machine Learning Research
Apple Machine Learning Research
阮一峰的网络日志
阮一峰的网络日志
博客园 - 叶小钗
博客园 - 三生石上(FineUI控件)
腾讯CDC
Hugging Face - Blog
Hugging Face - Blog
博客园 - 【当耐特】
小众软件
小众软件
博客园 - 司徒正美
罗磊的独立博客
云风的 BLOG
云风的 BLOG
B
Blog RSS Feed
博客园 - 聂微东

博客园 - 海蓝心

业余时间折腾了个微信小程序版本的街机游戏模拟器(吾爱街机),8090后的童年回忆,欢迎大家体验 Flex Formatter (flex ide 代码格式工具) 安装Android 开发工具 (二) Android 是什么 (一) 个性化印品DIY制作软件《光影21度》(.net客户端与flex通信技术) flash 电子相册 功能强大 在线传输软件 支持断点续传 flex版 个性化数码印刷在线diy 学习XSLT的知识积累 XMLHttpRequest介绍 委托学习笔记二(多播委托) 委托学习笔记一(调用委托) 委托和事件— 一个虚构的故事 ASP.NET程序中常用的三十三种代码(6) ASP.NET程序中常用的三十三种代码(3) ASP.NET程序中常用的三十三种代码(4) ASP.NET程序中常用的三十三种代码(2) ASP.NET程序中常用的三十三种代码(1) C#有关基础知识汇集
ASP.NET程序中常用的三十三种代码(5)
海蓝心 · 2005-11-18 · via 博客园 - 海蓝心

  24.DataGrid选定比较底下的行时,为什么总是刷新一下,然后就滚动到了最上面,刚才选定的行因屏幕的关系就看不到了。
  
  page_load
  page.smartNavigation=true
  
    25.在Datagrid中修改数据,当点击编辑键时,数据出现在文本框中,怎么控制文本框的大小 ?
  
  private void DataGrid1_ItemDataBound(obj sender,DataGridItemEventArgs e)
  {
   for(int i=0;i<e.Item.Cells.Count-1;i++)
    if(e.Item.ItemType==ListItemType.EditType)
    {
     e.Item.Cells[i].Attributes.Add("Width", "80px")
    }
  }
  
    26.对话框
  
  private static string ScriptBegin = "<script language=\"JavaScript\">";
  private static string ScriptEnd = "</script>";
  
  public static void ConfirmMessageBox(string PageTarget,string Content)
  {
   string ConfirmContent="var retValue=window.confirm(’"+Content+"’);"+"if(retValue){window.location=’"+PageTarget+"’;}";
  
   ConfirmContent=ScriptBegin + ConfirmContent + ScriptEnd;
  
   Page ParametERPage = (Page)System.Web.HttpContext.Current.Handler;
   ParameterPage.ReGISterStartupScript("confirm",ConfirmContent);
   //Response.Write(strScript);
  }
  
    27. 将时间格式化:string aa=DateTime.Now.ToString("yyyy年MM月dd日");
  
    1.1 取当前年月日时分秒
  
  currentTime=System.DateTime.Now;
  
    1.2 取当前年
  
  int 年= DateTime.Now.Year;
  
    1.3 取当前月
  
  int 月= DateTime.Now.Month;
  
    1.4 取当前日
  
  int 日= DateTime.Now.Day;
  
    1.5 取当前时
  
  int 时= DateTime.Now.Hour;
  
    1.6 取当前分
  
  int 分= DateTime.Now.Minute;
  
    1.7 取当前秒
  
  int 秒= DateTime.Now.Second;
  
    1.8 取当前毫秒
  
  int 毫秒= DateTime.Now.Millisecond;
  
    28.自定义分页代码:
  
    先定义变量 :
  
  public static int pageCount; //总页面数
  public static int curPageIndex=1; //当前页面
  
    下一页:
  
  if(DataGrid1.CurrentPageIndex < (DataGrid1.PageCount - 1))
  {
   DataGrid1.CurrentPageIndex += 1;
   curPageIndex+=1;
  }
  
  bind(); // DataGrid1数据绑定函数
  
    上一页:
  
  if(DataGrid1.CurrentPageIndex >0)
  {
   DataGrid1.CurrentPageIndex += 1;
   curPageIndex-=1;
  }
  
  bind(); // DataGrid1数据绑定函数
  
    直接页面跳转:
  
  int a=int.Parse(JumpPage.Value.Trim());//JumpPage.Value.Trim()为跳转值
  
  if(a<DataGrid1.PageCount)
  {
   this.DataGrid1.CurrentPageIndex=a;
  }
  
  bind(); 
  

posted on 2005-11-18 10:43  海蓝心  阅读(266)  评论()    收藏  举报