.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Post New Web Links

"Dynamic referencing"

Posted By:      Posted Date: September 16, 2010    Points: 0   Category :ASP.Net
Hello,I dont even know how to call it, I dont think dynamic referencing is correct, but here's my problem:I am used to other programming languages like ActionScript for example. Over there, if you have 10 objects that are named obj1, obj2, obj3 and so on, and wanted to call em on your code, you could write this:for (byte i = 1; i <= 10; i++) { ["obj" + i].Property = x; } That way, you would set the "Property" to x in all 10 objects. However, unless im doing it wrong, you cannot call objects such as divs or w/e like that ["name" + increment]. Is there a way to do that? I've tryed this:for (byte i = 0; i <= 10; i++) { string name = "obj" + i.ToString(); Control x = FindControl(name); } This seemed to be the right way but... this way I cant set for example an ImageButton.Enabled = false, neither can I set a div.Style["background-image"] = "x";... what should I do?Thank you for your attention,Allan

View Complete Post

More Related Resource Links

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend