码迷,mamicode.com
首页 > 其他好文 > 详细

Test

时间:2014-08-05 13:22:39      阅读:165      评论:0      收藏:0      [点我收藏+]

标签:http   os   io   ar   cti   html   amp   new   

Source file

SqlConnection strcon = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["strcon"]);
        strcon.Open();
        SqlDataAdapter sda = new SqlDataAdapter("select a.*,b.companyname from tb_stock a left join tb_company b on a.companyid=b.id where type=‘" + type + "‘ and jz=0", strcon);
        DataSet ds=new DataSet();
        sda.Fill(ds, "Reckoning");
        GridView1.DataSource = ds.Tables["Reckoning"];
        GridView1.DataKeyNames = new string[]{"id"};
        GridView1.DataBind();
    }
    protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        GridView1.PageIndex = e.NewPageIndex;
        this.bind();
    }
    protected void GridView1_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
    {
        string id = GridView1.DataKeys[e.NewSelectedIndex].Value.ToString() ;
        Response.Write("<script>window.open(‘open.aspx?id=" + id + "&type=" + Request["type"] + "&je=" + GridView1.Rows[e.NewSelectedIndex].Cells[3].Text + "&com="+GridView1.Rows[e.NewSelectedIndex].Cells[1].Text+"‘,‘‘,‘width=380,height=200,scrollbars=no‘)</script>");
    }

    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if(e.Row.RowType==DataControlRowType.DataRow)
        {
            if ((e.Row.Cells[1].Text).Length > 6)
            {
                e.Row.Cells[1].Text = (e.Row.Cells[1].Text).Substring(0, 6) + "…";
            }
            if ((e.Row.Cells[2].Text).Length > 6)
            {
                e.Row.Cells[2].Text = (e.Row.Cells[2].Text).Substring(0, 6) + "…";
            }

 

Test,布布扣,bubuko.com

Test

标签:http   os   io   ar   cti   html   amp   new   

原文地址:http://www.cnblogs.com/wipphj/p/3891695.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!