Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi, i would like to add something like that in the html view in the aspx code, but i dont know how to do it...

 

n=variable;

for (int i=0; i<n;i++)

{

<asp:RadioButton id=G<%i%>Good runat="server" Text="Good" GroupName="G1" />

<asp:RadioButton id=G1Normal runat="server" Text="Normal" GroupName="G1" />

<asp:RadioButton id=G1Bad runat="server" Text="Bad" GroupName="G1" />

}

 

I want G followeb by a number, in order to name the radiobutton with a different name to check them after this.

 

I tried <%for (int...)%> but it doesnt work

The same in G<%i%>, i would like to appear G1, G2....

 

I would appreciate any help...

Thanks in advance.

Adolfo.
  • Moderators
Posted

You cannot mix server and client code, you need to do something like this...

 

for ( int i=0;i<n;i++)

{

RadioButton rb = new RadioButton();

Page.Controls.add(rb)

//or you can add the control to a Panel

}

Visit...Bassic Software
Posted

Can't he do something like this :

 

<%
 for( int i = 0; i<n; i++ )
 {
%>
<asp:RadioButton id=G<%i%>Good runat="server" Text="Good" GroupName="G1" /> 
<asp:RadioButton id=G1Normal runat="server" Text="Normal" GroupName="G1" /> 
<asp:RadioButton id=G1Bad runat="server" Text="Bad" GroupName="G1" /> 
<%
}
%>

 

Can't we do this just like it could be done in ASP ?

"If someone say : "Die mortal !"... don't stay to see if he isn't." - Unknown

"Learning to program is like going out with a new girl friend. There's always something that wasn't mentioned in the documentation..." - Me

"A drunk girl is like an animal... it scream at everything like a cat and roll in the grass like a dog." - Me after seeing my girlfriend drunk and some of her drunk friend.

C# TO VB TRANSLATOR

Posted

Okay ! Hehe.

Remembered some ASP code that could do some things like this.

"If someone say : "Die mortal !"... don't stay to see if he isn't." - Unknown

"Learning to program is like going out with a new girl friend. There's always something that wasn't mentioned in the documentation..." - Me

"A drunk girl is like an animal... it scream at everything like a cat and roll in the grass like a dog." - Me after seeing my girlfriend drunk and some of her drunk friend.

C# TO VB TRANSLATOR

Posted

Okayyy.

Get it running in my head!

Thanks again Robby!

:D :p

"If someone say : "Die mortal !"... don't stay to see if he isn't." - Unknown

"Learning to program is like going out with a new girl friend. There's always something that wasn't mentioned in the documentation..." - Me

"A drunk girl is like an animal... it scream at everything like a cat and roll in the grass like a dog." - Me after seeing my girlfriend drunk and some of her drunk friend.

C# TO VB TRANSLATOR

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...