前台代码 .aspx                    

                    <asp:TemplateField HeaderText="快递单号">
                        <ItemTemplate>
                            <asp:HyperLink ID="HyperLink1"  runat="server"  Text='<%#Eval("product_express_id")%>' Target="_blank"></asp:HyperLink>
                        </ItemTemplate>
                    </asp:TemplateField>

 后台代码.cs

#region

    protected void GridView_username_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            DataRowView dv = e.Row.DataItem as DataRowView;
            result = dv["product_express"].ToString();
            string com = PingyinClass.GetSpellCode(result);
            results = dv["product_express_id"].ToString();
            ((HyperLink)e.Row.Cells[5].FindControl("HyperLink1")).NavigateUrl = "http://www.kuaidi100.com/chaxun?com=" + com + "&nu=" + results;
        }
    }

#endregion

posted on 2013-05-23 16:29  Fyling  阅读(250)  评论(0)    收藏  举报