String str;
String url= "company_user_c_website";
//不包含http://
if(-1==url.indexOf("http://"))
{
str = "http://"+url;
}
else
{str=url;
}
网址:<a href="<%=url%>" target="_blank"><%=company_user_c_website%></a>

解决方案 »

  1.   

    <a href="<%=url%>"
    中间修改成str 才对的吧
      

  2.   


    public string str;
    public string url= "http://www.baidu.com";
    //不包含http://
    if(-1==url.indexOf("http://"))
    {
        str = "http://"+url;
    }
    else
    {
        str=url;
    }网址:<a href="<%=url%>" target="_blank"><%=str%></a>
      

  3.   

    要注意后台的变量要是public
      

  4.   


    public string str;
    public string url= "http://www.baidu.com";public void Page_Load(object sender,EventArgs e)
    {
        if(!IsPostBack)
        {
            //不包含http://
            if(-1==url.indexOf("http://"))
           {
                str = "http://"+url;
           }
           else
           {
                 str=url;
           }
        }
    }网址:<a href='<%=url%>' target="_blank"><%=str%></a>
      

  5.   


    因为这个URL是变量 
    现在好像是定义出错了
    public string url= "http://www.baidu.com";publicString url= "company_user_c_website";这个company_user_c_website 是用SqlDataReader = DB.RunProcGetReader 读出来的
      

  6.   


    SqlDataReader dt = DB.RunProcGetReader("caozuo 1,'[com_job_view]', 'top 1 company_user_c_website',' company_job_info_id=''" + Request("company_job_info_id") + "''',''");
    while (dt.Read()) {
    str() = dt(0).ToString();
    }//不包含http://
    if (-1 == str().IndexOf("http://")) {
    url = "http://" + str();} else {
    url = str();
    }
    网址:<a href="<%=url%>" target="_blank"><%=str%></a>
      

  7.   

    str();
    str() = dt(0).ToString();没出错???
    str = dt(0).ToString();
      

  8.   


    SqlDataReader dt = DB.RunProcGetReader("caozuo 1,'[com_job_view]', 'top 1 company_user_c_website',' company_job_info_id=''" + Request("company_job_info_id") + "''',''");
    while (dt.Read()) {
        str = dt(0).ToString();
    }//不包含http://
    if (-1 == str().IndexOf("http://")) {
        url = "http://" + str();} else {
        url = str();
    }