views:

10

answers:

1

Hi Everyone,

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;

`

+1  A: 

I'd say these are the droids you are looking for:

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

You seem to be making too many assignments in that statement, one is quite enough there :)

Piskvor
Thank you Piskvor that helped!!
Marina