小编Nag*_*raj的帖子

在C#后面的代码中实现javascript确认框

我想从后面的代码实现javascript确认框.

我的要求是根据我需要实现diff功能的结果,我需要提出一个确认框

例如;

如果OK确认框添加税

如果取消则不加税

我正在尝试这样的事情,但它没有帮助我

ScriptManager.RegisterStartupScript(Page, Page.GetType(), "confirm", "confirm('Add tax');", true);
Run Code Online (Sandbox Code Playgroud)

谁能帮忙.

我的示例代码是

protected void Button1_Click(object sender, EventArgs e)
{
    Double mrp = 200.00;

    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "confirm", "return confirm('Add Tax');", true);
    if (Confirm == "Ok")
    {
        //Add tax to mrp
    }
    else
    {
        //No tax for mrp
    }
}
Run Code Online (Sandbox Code Playgroud)

谢谢..

asp.net c#-4.0

5
推荐指数
1
解决办法
4万
查看次数

每个循环中有多个线程

我目前正在执行一项耗费大量时间执行的任务.所以,我选择了线程.但我在我的线程中有一个foreach循环,我想在其中创建多个线程.我担心这是适当的方法.

我的代码类似于以下内容:

    Thread th= new Thread(new ThreadStart(ThreadProcedure));
    th.IsBackground = true;
    th.Start();

   public void ThreadProcedure()
   {
    //I have datatable here
    foreach(DataRow in mytable.rows)
    {
    //here I want to create a multiple threads, say like

    //Thread1 on which I want to run method1
     Method1(dr["Column1"].ToString());
    //Thread2 on which I want to run method2
     Method2(dr["Column2"].ToString());
    //Thread3 on which I want to run method3
       Method3(dr["Column3"].ToString());
    }
  }
Run Code Online (Sandbox Code Playgroud)

在我的foreach中,我通过传递datarow中单元格的值来运行一些方法.

c# multithreading

2
推荐指数
1
解决办法
1955
查看次数

标签 统计

asp.net ×1

c# ×1

c#-4.0 ×1

multithreading ×1