c# - Trying to find correct way to infinitely loop in my code-behind file -
I rotate sequentially in the C # code-behind section of a master content page through a series of numerical images I'm working with a project I am trying to start with 1, move it to 5, and then start the process again. This is what I have so far. This does not work because you need additional conditions in the Edit: After trying to include the label in "Goto", I can not find the page to load. Here is the rest of the file: Just use the nested loop. I chose the While everyone said, remember that unless it is just an example, This is a very stupid thing.> The image URL in this user will not be read , so you can just calculate what the result will really be and do not need to waste time and resources which is an infinite loop It can turn into Edit: The question has developed. Instead of using loops, store an app variable: Here are some implications, especially when many-servers deal with farms but this should be enough for your case. If you hit a user-load in which multiple servers are required, the use of workflows in this way would probably be irrelevant, because the results will still be more random. In place of if section.
int i = 1; Restart: While (i & lt; 6) {Image1.ImageUrl = "~ / Images /" + i.ToString () + ".png"; I ++; If (i == 5) {restart; }}
using the system; Using System.Collections.Generic; Using System.Linq; Using System.Web; Using System.Web.UI; Using System.Web.UI.WebControls; Name Location Clark (Public Partial Class Home: System.web.ui page) {Secure Object Page_load (Object Sender, EventAurge E) {if (IsPostBack) {SetImageURL}; // To ensure image load on page load}} Secure timer 1_Tick protected (object sender, EventArgs e) {SetImageURL (); // Replaced from previous logic} Private Zero SetImageURL () {// random function will choose between 1 and 5, which will be // // from 1 to 5 images; // random _rand = new Random (); // int i = _rand.Next (1, 5); //Image1.ImageUrl = "~ / Images" "+ i.ToString () +" .png "; Int i = 1; Restart: While (i & lt; 6) {Image1.ImageUrl =" ~ / Images / "+ I.ToString () +" .png "; i ++; if (i == 5) {restart;}} / * while (true) {int i = 1;} {Image1.ImageUrl =" ~ / Images / "+ i.ToString () +" .png "; i ++;} while (i & lt; 6);} * /}}}
to {{(int i = 1; i <6 ; I ++; {Image1.ImageUrl = "~ / Images" "+ i.ToString () +". PNG ";}} While (/ * Additional Terms * /)
do /
while architecture because it is already in your form The best map is, but just a plain-yellow '
while also moves.
object imageIndexObj = application ["imageIndex"]; Int imageIndex; If (image index is ignored == zero) imageIndex = 1; Else imageIndex = (int) imageIndexObj; Image1.ImageUrl = "~ / Images" + (Image Index% 5) + ".png"; Application ["imageindex"] = imageindex + 1;
session here
application , if you want to place five images in each cycle for each request, then each This is your call code for request, other than that, though.
Comments
Post a Comment