|
-
Jun 17th, 2003, 08:12 AM
#1
Thread Starter
Frenzied Member
Generating code in ASP.Net using "For"
I have some code looking like this in JavaScript:
Code:
<script language="JavaScript"><!--
for (i=1;i<11;i++){
document.write('<tr>');
document.write('<td><select name="komp' +i+ '" style="WIDTH: 125px" onclick="click_komp();">');
document.write('<% Do While Not Rs1.EOF %>');
document.write('<option value="<%=rs1.fields(0).value%>"><%=rs1.fields(2).value%></option>');
document.write('<%Rs1.MoveNext()%>');
document.write('<%Loop%>');
document.write('</select>');
document.write('</td>');
document.write('<td><select name="dimen' +i+ '" onclick="saet_dim' +i+ '();">');
document.write('<option selected value="none"> </option>');
document.write('</select>');
document.write('</td>');
document.write('<td><select name="serie' +i+ '" onclick="calc_serie();">');
document.write('<% Do While Not Rs7.EOF %>');
document.write('<option value="<%=rs7.fields(0).value%>"><%=rs7.fields(1).value%></option>');
document.write('<%Rs7.MoveNext()%>');
document.write('<%Loop%>');
document.write('</select>');
document.write('</td>');
document.write('<td><input type="text" name="kappedim' +i+ '" class="resfelt" size="3" value="90" readonly></td>');
//document.write('<td><input type="text" name="prisMedie' +i+ '" class="tastfelt" size="3" value="4,54" ></td>');
//document.write('<td><input type="text" name="prisPeh' +i+ '" class="tastfelt" size="3" value="7,00"></td>');
document.write('</tr>');
}
//--></script>
Now I'm writing an ASP.Net application which use server controls. How can I make some automated content like using "For..." in JavaScript?
-
Jun 17th, 2003, 09:41 AM
#2
Frenzied Member
Are you looking for something that does the same as Document.Write? Then it is Response.Write. But its not exactly the same as in javascript for it positioning. In javascript it begins to write whereever you put your script but its not the case in Response.Write.
Alternativley you can use a label or literal control and place it on the form then use that "For..." to build its text porperty.
'Heading for the automatic overload'
Marillion, Brave, The Great Escape, 1994
'How will WE stand the FIRE TOMORROW?'
Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979
-
Jun 19th, 2003, 08:49 AM
#3
Thread Starter
Frenzied Member
Hi, what I wish to to is to generate 100 text fields in a table without write the code 100 times, if you understand.
'Alternativley you can use a label or literal control and place it on the form then use that "For..." to build its text porperty.'
Can I do that someway using this?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|