creating server controls on the Fly from code behind

R

Ryan Ternier

I'm running through a loop printing out an un-ordered list of Items.

Each Item (when selected through JavaScript) will get highlighted, and 4
images will be shown with it.

Currently their static images because these are simply screens for the
final product.

However, it would be much nicer to have them post back to the server so
i can get the values from them, rather than post to the server and
having to read Querystring and Form values.

Is there a way of doing this without making a mess of the code?

Current Code:

string strJava = "OnMouseOver=\"Highlight(this);\"
OnClick=\"Select(this, '" + r["Number"].ToString().Replace("-","_") +
"');\" onmouseout=\"deHighlight(this);\"";

string strImage = "<img id=\"del" +
r["Number"].ToString().Replace("-","_") + "\" class=\"DItemControls\"
src=\"Images/delete.gif\">";

strImage += "<img id=\"up" + r["Number"].ToString().Replace("-","_") +
"\" class=\"DItemControls\" src=\"Images/navigate_up.gif\">";

strImage += "<img id=\"down" + r["Number"].ToString().Replace("-","_") +
"\" class=\"DItemControls\" src=\"Images/navigate_down.gif\">";

strImage += "<img id=\"view" + r["Number"].ToString().Replace("-","_") +
"\" class=\"DItemControls\" src=\"Images/button_item_view.gif\">";


return "<ul>" + "<li " + strJava + " class=\"Item\" >" +
r["Number"].ToString() + " : " + r["Description"].ToString() + strImage
+ " " + "</li>" + "</ul>\n"

I'd like to do this with 4 functions, where all delete buttons call the
same function, and I grab the Data I need through the sender object.

Any help would be great!

/RT
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,832
Latest member
GlennSmall

Latest Threads

Top