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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help creating Dynamic web controls

Status
Not open for further replies.

YvonneTsang

Programmer
Sep 28, 2001
37
CA
I an new to Asp.net and I need some help. In ASP I was able to create Dynamic controls on my page by having the ASP use Response.Write and the controls that I wanted. An example would be

<Body>

<%
for i = 0 to count
If Text
Response.Write &quot; <input id=a type=textbox&quot; & i & &quot; name=a&quot; & i & &quot; ></input>&quot;
else
Response.Write &quot; <input id=a type=checkbox&quot; & i & &quot; name=a&quot; & i & &quot; ></input>&quot;
loop

%>

</Body>

How can I get this sort of functionality out of .net? The number of times it loops through can change, so I can't just make the maximum number of inputs and set visible to false. There must be an easy for me to do this still and keep everything in .net. I know I can still use old ASP code but that is not what I really want to do.

Thanks in Advance.
 
create a panel on your page (the html for this is Div) at design time. Call it myControls. Then in your code behind put this into your loop

dim t as new textbox()

t.text = &quot;mytext&quot;
mycontrols.controls.add(t)

That'l do donkey, that'l do
[bravo] Mark
If you are unsure of forum etiquette check here faq796-2540
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top