注册 | 登录 忘记密码? 51cto首页 | 博客 | 论坛 | 招聘
热点文章 WEB3.0来了,能知道100米..
 帮助
2008-04-01 14:36:06


类别:未分类 | 阅读全文(257) | 回复(0)      

2008-03-21 17:00:43
private ArrayList NonstopLines(string strStart, string strEnd)
    {
        ArrayList al = new ArrayList();
        for (int i = 0; i < busLine.Count;i++ ) //循环查找每辆直达车
        {
          BusInfo c = (BusInfo)busLine[i]; //将数组重新定义
          string[] arrLines = c.strLines.Split("-".ToCharArray());//将行车路线拆分,放进数组
          int iUpLine = BusLineName.IndexOfArray(arrLines,strStart); //公交车上下行判断
          int iDownLine = BusLineName.IndexOfArray(arrLines, strEnd);
          if (iUpLine >= 0 && iDownLine >= 0)
          {
            nonstopLine nl = new nonstopLine(); //实例化nonstopLine类
            nl.strLineName = c.strLineName; //将从数据库读出的车次信息赋给要输出的车次信息
            nl.strlineCount = Convert.ToString(Math.Abs(iUpLine-iDownLine));//计算行车站数
            string strLines = ""; //定义一个字符串变量,用来保存行车路线站点
            if (iUpLine > iDownLine)
            {
                for (int j = iUpLine; j >= iDownLine; j--)
                {
                  strLines += arrLines[j] + "-";
                }
            }
            else
            {
                for (int j = iUpLine; j <= iDownLine;j++ )
                {
                  strLines += arrLines[j] + "-";
                }
            }
            strLines = strLines.Substring(0, strLines.Length - 1); //去掉字符串最后面的"-"
            nl.strLines = strLines;
            al.Add(nl);
          }
         
        }
        return al;
    }


类别:未分类 | 阅读全文(47) | 回复(0)      

2008-02-18 14:07:30


类别:未分类 | 阅读全文(202) | 回复(1)      

2008-01-25 16:30:08
  在网页设计之家看到了这些知识,觉得挺实用的,就拿过来和大家分享一下。如该文作者看到,还望支持理解。技术就是用来交流的,不是吗?

29.DataGrid使用:
  添加删除确认:
private void DataGrid1_ItemCreated(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
 foreach(DataGridItem di in this.DataGrid1.Items)
 {
  if(di.ItemType==ListItemType.Item||di.ItemType==ListItemType.AlternatingItem)
  {
   ((LinkButton)di.Cells[8].Controls[0]).Attributes.Add(" confirm(’确认删除此项吗?’);");
  }
 }
}
  样式交替:
ListItemType itemType = e.Item.ItemType;
if (itemType == ListItemType.Item )
{
 e.Item.Attributes[" = "javascript:this.style.backgroundColor=’#FFFFFF’;";
 e.Item.Attributes[" = "javascript:this.style.backgroundColor=’#d9ece1’;cursor=’hand’;" ;
}
else if( itemType == ListItemType.AlternatingItem)
{
 e.Item.Attributes[" = "javascript:this.style.backgroundColor=’#a0d7c4’;";
 e.Item.Attributes[" = "javascript:this.style.backgroundColor=’#d9ece1’;cursor=’hand’;" ;
}
  添加一个编号列:
DataTable dt= c.ExecuteRtnTableForAccess(sqltxt); //执行sql返回的DataTable
DataColumn dc=dt.Columns.Add("number",System.Type.GetType("System.String"));
for(int i=0;i<dt.Rows.Count;i++)
{
 dt.Rows[i]["number"]=(i+1).ToString();
}
DataGrid1.DataSource=dt;
DataGrid1.DataBind();
  DataGrid1中添加一个CheckBox,页面中添加一个全选框
private void CheckBox2_CheckedChanged(object sender, System.EventArgs e)
{
 foreach(DataGridItem thisitem in DataGrid1.Items)
 {
  ((CheckBox)thisitem.Cells[0].Controls[1]).Checked=CheckBox2.Checked;
 }
}
  将当前页面中DataGrid1显示的数据全部删除
foreach(DataGridItem thisitem in DataGrid1.Items)
{
 if(((CheckBox)thisitem.Cells[0].Controls[1]).Checked)
 {
  string strloginid= DataGrid1.DataKeys[thisitem.ItemIndex].ToString();
  Del (strloginid); //删除函数
 }
}


类别:未分类 | 阅读全文(61) | 回复(0)      

2007-07-27 15:45:25


类别:未分类 | 阅读全文(107) | 回复(0)      

2007-07-25 18:15:56


类别:未分类 | 阅读全文(153) | 回复(0)      

2007-07-25 18:10:06


类别:未分类 | 阅读全文(207) | 回复(0)      

2007-07-11 11:48:52


类别:未分类 | 阅读全文(154) | 回复(0)      

2007-07-10 12:54:55


类别:未分类 | 阅读全文(488) | 回复(2)      

2007-06-08 16:27:06


类别:未分类 | 阅读全文(1310) | 回复(1)