J
Jax
I am looking to populate web page with controls as a
result of a database query.
eg (pseudocode)
<%
foreach(Garment g in GetStuffFromDB())
{
//add controls
Response.Write("<asp:Button id = 'Button'"+ctr.ToString()
+"/>")
}
%>
This doesn't work at all, I get nothing, not even one
button in the corner, i'm not sure why, probably because
i'm using the wrong object to write or something.
It does work with standard HTML controls although
sometimes those controls sporadically decide not to show
up.
A more complete example of my code is below with the style
tag being assigned to.
<%
int startLeft = 200;
int startTop = 200;
int ctr = 101;
int placeCtr = 20;
ArrayList al = GetGarmentsFromDB();
foreach(Garment g in al)
{
Response.Write("<SELECT style = 'Z-INDEX: "+ctr.ToString()
+"; LEFT: 220px; POSITION: absolute;
TOP: "+placeCtr.ToString()+"px; WIDTH: 100px; HEIGHT:
50px' />");
Response.Write("<br></br>");
ctr++;
placeCtr += 50;
}
%>
Unfortunately if this code runs only two of the four
results show up. I get only two comboBoxes rather then
four. Strangely enough if I add:
Response.Write("<input style = 'Z-INDEX: "+ctr.ToString()
+"; LEFT: 220px; POSITION: absolute;
TOP: "+placeCtr.ToString()+"px; WIDTH: 100px; HEIGHT:
50px' />");
in the line after I add the html select I get 4 comboBoxes
and 4 inputs.
So to recap, WebControls don't work at all and html
elements work sporadically, what am I doing wrong?
Any help would be greatly appreciated.
jax
result of a database query.
eg (pseudocode)
<%
foreach(Garment g in GetStuffFromDB())
{
//add controls
Response.Write("<asp:Button id = 'Button'"+ctr.ToString()
+"/>")
}
%>
This doesn't work at all, I get nothing, not even one
button in the corner, i'm not sure why, probably because
i'm using the wrong object to write or something.
It does work with standard HTML controls although
sometimes those controls sporadically decide not to show
up.
A more complete example of my code is below with the style
tag being assigned to.
<%
int startLeft = 200;
int startTop = 200;
int ctr = 101;
int placeCtr = 20;
ArrayList al = GetGarmentsFromDB();
foreach(Garment g in al)
{
Response.Write("<SELECT style = 'Z-INDEX: "+ctr.ToString()
+"; LEFT: 220px; POSITION: absolute;
TOP: "+placeCtr.ToString()+"px; WIDTH: 100px; HEIGHT:
50px' />");
Response.Write("<br></br>");
ctr++;
placeCtr += 50;
}
%>
Unfortunately if this code runs only two of the four
results show up. I get only two comboBoxes rather then
four. Strangely enough if I add:
Response.Write("<input style = 'Z-INDEX: "+ctr.ToString()
+"; LEFT: 220px; POSITION: absolute;
TOP: "+placeCtr.ToString()+"px; WIDTH: 100px; HEIGHT:
50px' />");
in the line after I add the html select I get 4 comboBoxes
and 4 inputs.
So to recap, WebControls don't work at all and html
elements work sporadically, what am I doing wrong?
Any help would be greatly appreciated.
jax