girdview 操作

  protected void DataList1_ItemDataBound(object sender, DataListItemEventArgs e)
    {
        if((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem ) )
        {

            HyperLink str = (HyperLink)e.Item.FindControl("HyperLink1");
            str.Text = "["+moondefault.classname(int.Parse(str.Text))+"]";

            HyperLink str3 = (HyperLink)e.Item.FindControl("HyperLink3");
            string str3navi = str3.Text;
            string tempstr=moondefault.writename(int.Parse(str3.Text));
            tempstr = tempstr.Length > 4 ? tempstr.Substring(0, 4) : tempstr;
            str3.Text = tempstr;
            str3.NavigateUrl = "myweb.aspx?blog=" + str3navi;
            str3.Target = "_blank";

            HyperLink str2 = (HyperLink)e.Item.FindControl("HyperLink2");
            str2.Text = str2.Text.Length > 18 ? str2.Text.Substring(0, 17) : str2.Text;
            string temps2 = str2.NavigateUrl.ToString();
            str2.NavigateUrl = "mywebrz.aspx?blog=" + str3navi + "&article=" + temps2;


        }
    }


If(gridview.rows.count==0)
{
}


e.Row.RowType== DataControlRowType.DataRow

你可能感兴趣的:(view)