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

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
aimingoo的专栏
aimingoo的专栏
P
Proofpoint News Feed
宝玉的分享
宝玉的分享
MyScale Blog
MyScale Blog
The GitHub Blog
The GitHub Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
月光博客
月光博客
量子位
博客园 - 司徒正美
V
V2EX
I
InfoQ
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Vercel News
Vercel News
H
Hackread – Cybersecurity News, Data Breaches, AI and More
美团技术团队
N
Netflix TechBlog - Medium
L
LangChain Blog
IT之家
IT之家
Blog — PlanetScale
Blog — PlanetScale
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Stack Overflow Blog
Stack Overflow Blog
A
About on SuperTechFans
Microsoft Azure Blog
Microsoft Azure Blog

博客园 - 海蓝心

业余时间折腾了个微信小程序版本的街机游戏模拟器(吾爱街机),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)  评论()    收藏  举报