Click here to Skip to main content
15,891,473 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear Folks,

Please help me...

i have 5 server hidden field controls namely..

hdnDc1
hdnDc2
hdnDc3
hdnDc4
hdnDc5

how to those values through for loop..

im trying this, but it won't
C#
for(int i=0;i<=5;i++)
{
string test = hdnDc + i;
}

Please Answer me..
is it possible... ?

Thanks & Regards,
Kanag.M
Posted

I think u should have to store all values in one array and acess then to it via for loop.

And what is your error in above code!plz explain!
 
Share this answer
 
Comments
kanagmathes 7-Sep-12 7:40am    
Thanks Buddy..
i found an alternate way
Thanks for your reply...
try below code:-

test array variable gets all the server names..
and test2 variable get names in single variable...
C#
string[] test=new string[5];
 string test2="";
 for (int i = 0; i < 5; i++)
 {
     test[i]="hdnDc"+i;               //take it in array or
     test2 = test2 + " hdnDc" + i;    // Concate in single variable
 }
 
Share this answer
 
v2
Comments
kanagmathes 7-Sep-12 7:41am    
Thanks Buddy...
i found an alternate way
Thanks for your valuable reply
Please add your solution here,so if any other get same problem then it will be solved fast.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900