小编Raj*_*Raj的帖子

C#如何从控制台应用程序调用MVC Action方法

我正在处理控制台应用程序,它获取一些数据并调用MVC3 Action方法并将获取的数据作为参数传递给该操作方法.但我的问题是控制台应用程序如何知道数据成功传递\ MVC操作方法正确调用并且服务器上的mvc应用程序正在运行

这是我的代码:

public static void Main()
{
// Mvc application object intialization
                HomeController object_Mail = new HomeController();
            // Mvc action method call
           object_Mail.mailgateway(mvcemails); //mvcemails parameter passed to Actionmethod               
}
Run Code Online (Sandbox Code Playgroud)

请指导我......

谢谢,拉吉

c# asp.net-mvc

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

为什么 e.Row.Cells[2].Text 在 GridView1_RowDataBound 事件中总是显示 "" 或 null

这是我的代码

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
    if (e.Row.RowType == DataControlRowType.DataRow) {
        // DataRow data = ((DataRowView)e.Row.DataItem).Row;
        string ToolTipString = Convert.ToString(e.Row.Cells[2].Text);
        e.Row.Cells[2].Attributes.Add("title", ToolTipString);
        Label MyLabel = (Label)e.Row.FindControl("MyLabel");

        if (ToolTipString.Length < 20) {
            MyLabel.Text = ToolTipString;
        }
        else {
            MyLabel.Text = String.Format("{0}...", ToolTipString.Substring(0, 17));
            MyLabel.ToolTip = ToolTipString;
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

Convert.ToString(e.Row.Cells[2].Text);这里总是给我“”。我的代码有什么问题吗?

c# asp.net gridview

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

标签 统计

c# ×2

asp.net ×1

asp.net-mvc ×1

gridview ×1