Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

image change after validation

Status
Not open for further replies.

flnMichael

Programmer
Nov 13, 2003
96
US
Hey,
I have this piece of code in my codebehind (C#) for generating a tablecell with an image:

Code:
TableCell PassFailImage = new TableCell();

HyperLink hlnk = new HyperLink();
hlnk.ID = "passfaillight" + max_parm_count.ToString();
hlnk.ImageUrl = "images/whiteball.gif";
hlnk.Controls.Add(hlnk);
PassFailImage.Controls.Add(hlnk);

Now, I have another piece of code in the same codebehind. This is another textbox generation that has an onblur. The function does the right calculations and gets the right value at the end of the function, but I want the image to change. I may be doing the initial image generation wrong, with it being a new Hyperlink when I don't need it to be a hyperlink, I just wanted the image and that's the only way I could get it to show on the page.

Here's the function call:

Code:
TableCell Value = new TableCell();

TextBox _Value = new TextBox();
_Value.Width = 80;
_Value.ID = "Value" + max_parm_count.ToString();
_Value.Attributes["onblur"] = "validate2(this.form, " + max_parm_count.ToString() + ", passfaillight" + max_parm_count.ToString() + ", " + max_parms + ");";

Value.Controls.Add(_Value);

and here's some of the function:

Code:
function validate2(form, index, passfail, max_parms)
{
  pic = "images/whiteball.gif";
..
..
  passfail.src = pic;

I guess all I want to know is how to get the image in a tablecell the right way, then pass it in the function and change it when the function is through.

Any help would be appreciated.

Thanks
Mike
 
I see ASP.NET in your code, and I see client-side Javascript. This is the ASP forum, so you need to ask your question in one of those forums, probably Javascript.

forum216

Lee
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top