1

I am currently defining the src attribute of my Iframe with the URL + a ID (of specific person) that I am retrieving from a database.

It returns a picture that is stored at a repository for each person. For people that currently do not have a pic I would like the URL to be URL+00000 instead of the 404 error page.

I'm trying to do an if/else statement below, yet it's not picking it up for some reason. Can anyone see why?

Thank you for your help!!!!

`

protected void TreeView1_SelectedNodeChanged(object sender, EventArgs e)
      {

          string empID = ((System.Web.UI.WebControls.TreeView)(sender)).SelectedNode.Value;


          string pictarget =
              pictarget = (Convert.ToInt32(empID) > 99999) ? 
              pictarget = "http://website/OrgList:" + 00000 + "/picture" :
              pictarget = "http://website/OrgList:" + empID + "/picture";

          Frame2.Attributes["src"] = pictarget;

`

4

1 回答 1

1

我会说这些是您正在寻找的机器人:

string pictarget = (Convert.ToInt32(empID) > 99999) ? 
    "http://website/OrgList:" + 00000 + "/picture" :
    "http://website/OrgList:" + empID + "/picture";

您似乎在该声明中做了太多的任务,一个就足够了:)

于 2010-06-23T20:20:59.247 回答