C# 在Asp.net MVC特定时间提交后,是否有一个函数可以对3个文本框执行操作

C# 在Asp.net MVC特定时间提交后,是否有一个函数可以对3个文本框执行操作,c#,html,asp.net,asp.net-mvc,C#,Html,Asp.net,Asp.net Mvc,我将尝试解释这一点,因为它看起来很复杂。我有3个文本框输入,我想在第一个输入上执行操作,然后在一段时间后自动在第二个输入上执行相同的操作,在同一时间后,在第三个输入上执行相同的操作 <form action="@Url.Action("ShowResults")" id="sideForm" method="post" onsubmit="return SidebarValidatio

我将尝试解释这一点,因为它看起来很复杂。我有3个文本框输入,我想在第一个输入上执行操作,然后在一段时间后自动在第二个输入上执行相同的操作,在同一时间后,在第三个输入上执行相同的操作

        <form action="@Url.Action("ShowResults")" id="sideForm" method="post" onsubmit="return SidebarValidation()" autocomplete="off">
        <input type="text" class="form-control" id="firstInput" autocomplete="off" name="first" placeholder="Enter Keyword..." value="@Request["first"]"  required><br /><hr />
        <input type="text" class="form-control" id="secondInput" autocomplete="off" name="second" placeholder="Enter Keyword..." value="@Request["second"]" ><br /><hr />
        <input type="text" class="form-control" id="thirdInput" autocomplete="off" name="third" placeholder="Enter Keyword..." value="@Request["third"]" ><br /><hr />
        <div class="col"><button type="submit" id="sdSubmit" name="sideSubmit" class="btn btn-outline-primary" style="font-family: poppins">Custom SEARCH</button></div>
    </form>







自定义搜索
这是view.cshtml,如您所见,我有3个输入和提交按钮,当我单击按钮时,我希望在第一个输入上执行操作,5分钟后执行第二个输入,5分钟后执行第三个输入,5分钟后再次执行第一个输入,依此类推


如果有人有线索,请帮忙

我希望这会有所帮助。运行这个控制台应用程序,提取您需要的东西

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
namespace FileAdda
{
    public class Example
    {
        static string globalstr = "";
        static List<string> list = new List<string>();
        static void Main(string[] args)
        {
            //assume these as your input values.
            list.Add("Value 1");
            list.Add("Value 2");
            list.Add("Value 3");
            Run();
        }
        public static void Run()
        {
            // You can set it to whatever time you want.
            int seconds = 5 * 1000;
            var timer = new Timer(TimerMethod, null, 0, seconds);
            Console.ReadKey();
        }

        //Put your logic in this method.
        public static void TimerMethod(object o)
        {

            if (string.IsNullOrEmpty(globalstr))
            {
                globalstr = list.FirstOrDefault();
            }
            else
            {
                int lastindex = list.IndexOf(globalstr);
                if (lastindex == (list.Count - 1))
                {
                    globalstr = list[0];
                }
                else
                {
                    globalstr = list[lastindex + 1];
                }
            }
            Console.WriteLine($"The timer callback for {globalstr}");
        }
    }

}
使用系统;
使用System.Collections.Generic;
使用System.Linq;
使用系统线程;
命名空间FileAdda
{
公开课范例
{
静态字符串globalstr=“”;
静态列表=新列表();
静态void Main(字符串[]参数)
{
//假设这些是您的输入值。
列表。添加(“值1”);
列表。添加(“价值2”);
列表。添加(“值3”);
Run();
}
公共静态无效运行()
{
//您可以将其设置为您想要的任何时间。
整数秒=5*1000;
var timer=新计时器(TimerMethod,null,0,秒);
Console.ReadKey();
}
//把你的逻辑放在这个方法里。
公共静态无效时间方法(对象o)
{
if(string.IsNullOrEmpty(globalstr))
{
globalstr=list.FirstOrDefault();
}
其他的
{
int lastindex=list.IndexOf(globalstr);
if(lastindex==(list.Count-1))
{
globalstr=list[0];
}
其他的
{
globalstr=list[lastindex+1];
}
}
WriteLine($“用于{globalstr}的计时器回调”);
}
}
}

我希望这会有所帮助。运行这个控制台应用程序,提取您需要的东西

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
namespace FileAdda
{
    public class Example
    {
        static string globalstr = "";
        static List<string> list = new List<string>();
        static void Main(string[] args)
        {
            //assume these as your input values.
            list.Add("Value 1");
            list.Add("Value 2");
            list.Add("Value 3");
            Run();
        }
        public static void Run()
        {
            // You can set it to whatever time you want.
            int seconds = 5 * 1000;
            var timer = new Timer(TimerMethod, null, 0, seconds);
            Console.ReadKey();
        }

        //Put your logic in this method.
        public static void TimerMethod(object o)
        {

            if (string.IsNullOrEmpty(globalstr))
            {
                globalstr = list.FirstOrDefault();
            }
            else
            {
                int lastindex = list.IndexOf(globalstr);
                if (lastindex == (list.Count - 1))
                {
                    globalstr = list[0];
                }
                else
                {
                    globalstr = list[lastindex + 1];
                }
            }
            Console.WriteLine($"The timer callback for {globalstr}");
        }
    }

}
使用系统;
使用System.Collections.Generic;
使用System.Linq;
使用系统线程;
命名空间FileAdda
{
公开课范例
{
静态字符串globalstr=“”;
静态列表=新列表();
静态void Main(字符串[]参数)
{
//假设这些是您的输入值。
列表。添加(“值1”);
列表。添加(“价值2”);
列表。添加(“值3”);
Run();
}
公共静态无效运行()
{
//您可以将其设置为您想要的任何时间。
整数秒=5*1000;
var timer=新计时器(TimerMethod,null,0,秒);
Console.ReadKey();
}
//把你的逻辑放在这个方法里。
公共静态无效时间方法(对象o)
{
if(string.IsNullOrEmpty(globalstr))
{
globalstr=list.FirstOrDefault();
}
其他的
{
int lastindex=list.IndexOf(globalstr);
if(lastindex==(list.Count-1))
{
globalstr=list[0];
}
其他的
{
globalstr=list[lastindex+1];
}
}
WriteLine($“用于{globalstr}的计时器回调”);
}
}
}

“我想执行一个动作”,一个控制器
动作
,或者你只是想在5分钟后做点什么?动作控制器中有一些if条件,我想在5分钟后对这些输入执行。我会调查,看看这是否满足你的需要。谢谢史蒂夫,我很感激“我想执行一个动作”,控制器
动作
还是你只想在5分钟后做点什么?在动作控制器中有一些if条件,我想在5分钟后对这些输入执行。我会调查一下,看看这是否满足你的需要。谢谢你,史蒂夫,我很感激Run()函数是否可以接受参数,因为我从视图到控制器获取数据。您可以直接访问方法TimerMethod()中的值,然后从Run()调用它。Run()函数是否可以接受参数,因为我从视图到控制器获取数据。您可以直接访问方法TimerMethod()中的值,然后从Run()调用它。