如何在ASP.NET MVC中打印视图中的以下输出? [英] How to print following output in view in ASP.NET MVC?
本文介绍了如何在ASP.NET MVC中打印视图中的以下输出?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何打印Hello1,
Hello2,
Hello3,
Hello4如果start = 1且count = 4
同样我需要打印
Hello5,
Hello6,
Hello7如果start = 5且在asp.net mvc中count = 7?
其中start和count是action方法的参数,它们的值由查询字符串提供,Hello是常量字符串。
我尝试了什么:
我试过但我无法应用逻辑
解决方案
使用进行
循环: for(C#Reference)| Microsoft Docs [ ^ ]
How to print Hello1 ,
Hello2,
Hello3,
Hello4 if start=1 and count =4
similarly I have to print
Hello5,
Hello6,
Hello7 if start=5 and count=7 in asp.net mvc?
where start and count are parametes of action method and their values supplied by query string and Hello is constant string.
What I have tried:
I tried but I am Not able to apply logic
解决方案
Use a for
loop: for (C# Reference) | Microsoft Docs[^]
这篇关于如何在ASP.NET MVC中打印视图中的以下输出?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文