小编Dha*_*alR的帖子

FullCalendar不加载事件

FullCalendar在我的asp.net mvc应用程序中使用.它不会加载事件.我通过ajax调用获取事件列表.以下是我的代码.有什么问题.

<div class="row">
    <div class="col-lg-12">
        <section class="panel">
            <div class="panel-body">
                <div id="calendar"></div>
            </div>
        </section>
    </div>
</div>
<script type="text/javascript">
    jQuery.extend({
        getValues: function (url) {
            var result = null;
            $.ajax({
                url: url,
                type: 'get',
                dataType: 'json',
                async: false,
                success: function (data) {
                    result = data;
                },
                error: function (err) {
                    alert(JSON.stringify(err));
                }
            });
            return result;
        }
    });
    var jsonEvents = $.getValues('@Url.Action("GetEvents", "Booking")');
    alert(jsonEvents);

    //var jsonEvents = [{ title: "Dhaval, (4,6), 6", start: "05/21/2016 1:05:00 PM" },
    //    { title: "Mohit, …
Run Code Online (Sandbox Code Playgroud)

asp.net-mvc jquery fullcalendar fullcalendar-scheduler

7
推荐指数
1
解决办法
2090
查看次数

在单个线程上启动第二个消息循环不是有效的操作.请改用Form.ShowDialog

我有一个MDIPrent表格,这是我的主要表格.现在我通过单击LogOut MenuStrip登出表单Main_Form.在我的代码中,我已经阻止了重复实例.但是我得到了这个错误.我用Google搜索了很多东西,尝试了很多东西,但错误并没有消失.下面是Program.cs文件的代码:

using System.Diagnostics;
static class Program
{
    [STAThread]
    static void Main()
    {
        LoggedInUser = string.Empty;
        loginSuccess = false;
        String thisprocessname = Process.GetCurrentProcess().ProcessName;
        if (Process.GetProcesses().Count(p => p.ProcessName == thisprocessname) > 1)
            return;
        Application.EnableVisualStyles();
        Application.SetCompatibleTextRenderingDefault(false);
        MyApplicationContext context = new MyApplicationContext();
        Application.Run(context);

    }
    public class MyApplicationContext : ApplicationContext
    {
        private Login_Form lgFrm = new Login_Form();
        public MyApplicationContext()
        {
                try
                {
                    lgFrm.ShowDialog();
                    if (lgFrm.LogonSuccessful)
                    {
                        ////lgFrm.Close();
                        lgFrm.Dispose();
                        FormCollection frm = Application.OpenForms;
                        try
                        {
                            foreach (Form fc in frm)
                                fc.Close();
                        }
                        catch (Exception ex){} …
Run Code Online (Sandbox Code Playgroud)

c# winforms

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

即使文件为EXISTS,C#在`File.Exists`处的结果为FALSE

正如标题所说,我不知道我的代码有什么问题,但if (File.Exists)即使文件存在,也会给出否定结果.

以下是我的代码

if (File.Exists(ZFileConfig.FileName.Replace(".xml", "_abc.xml")))
Run Code Online (Sandbox Code Playgroud)

在这里,ZFileConfig.FileNameE:\\Application\\Application\\bin\\Debug\\resources\\FirstFile.xml

令人惊讶的是,这就是ZFileConfig.FileName.Replace(".xml", "_abc.xml")E:\\Application\\Application\\bin\\Debug\\resources\\FirstFile_abc.xml所需要的.EVENTHOUGH IF被罚下来返回TRUE.

在此输入图像描述

在此输入图像描述

.net c# winforms

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

在 C# 中打印时设置 PrinterSettings

几天前,我尝试通过右键单击照片来打印照片。出现一个对话框以选择打印机、纸张大小、质量等。我选择PaperSize = Legal。打印机可以在 Legal 尺寸的纸张上打印(我使用的是 HP LaserJet 1020 plus 打印机)。

现在我试图从 C# 打印一些东西,设置 PaperSize,但打印机无法打印 Legal。下面是我的代码。代码有什么问题吗?

this.printDocument.PrinterSettings.PrinterName = this.printSetting.PrinterName;
PaperSize pkCustomSize1 = new PaperSize("8.5x13", 1300, 850);
this.printDocument.DefaultPageSettings.PaperSize = pkCustomSize1;
this.printDocument.DefaultPageSettings.PaperSize.RawKind = 119;
printPreviewDialog.Document = printDocument;
printDocument.Print();

private void printDocument_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
    Graphics g = e.Graphics;
    Bitmap bm = new Bitmap(300, 3000);
    // Code for bm.
    g.DrawImage(bm, 0, 0);
}
Run Code Online (Sandbox Code Playgroud)

所以问题是,设置 PaperSize(和 PrinterSetting)的正确方法是什么?还有一件事,我搜索了MaximumPrintableArea一台打印机。我的打印机有最大 A4 尺寸,为什么它可以打印Legal

在此处输入图片说明

在此处输入图片说明

.net c# printing winforms

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

如何在RDLC中设置参数值

我在报告中为日期范围添加了两个文本框.要填充文本框中的值,我将参数设置为文本框.

现在,日期范围来自名为DateRange的表单,该表单具有两个DateTimePickers.

如何设置rdlc中的文本框的值等于这些DataTimePickers?

.net c# rdlc winforms dynamic-rdlc-generation

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

属性路由在MVC4中不起作用

Attribute RoutingMVC4申请中使用.我已设定路线[Route("test-{testParam1}-{testParam2}")].这里`{testParam2}'可能包含'test'这个词.例如,如果我输入如下的网址,

localhost:33333/test-temp-test-tempparam2
Run Code Online (Sandbox Code Playgroud)

这给了我404错误.在url中,这里{testParam2}有两个单词test tempparam2格式化为test-tempparam2.当test单词位于最后位置时{testParam2},它运行良好.这意味着如果网址像.../test-temp-tempParam2-test运行良好.但是下面给出错误..../test-temp-test-tempParam2.

以下是可能有帮助的代码......

[Route ("test-{testParam1}-{testParam2}")]
public ActionResult Foo (int testParam2) {...}
Run Code Online (Sandbox Code Playgroud)

现在尝试关注两个网址.

  1. localhost:(port)/test-temp-1

  2. localhost:(port)/test-test-temp-1

在我的情况下,第二个错误.在这种情况下第一参数被格式化为test-temptest temp.首先运行良好.

如何解决这个问题呢?

c# asp.net-mvc-routing asp.net-mvc-4 attributerouting

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

32位winform应用程序不能在64位操作系统上运行

我有两台笔记本电脑.

1)BuildLaptop->我编写应用程序的笔记本电脑.Windows 7旗舰版32位,适用于数据库的Office 2007

2)TestLaptop->测试应用程序.Windows 7旗舰版64位,Office 2007.

我的应用程序包含几个构建为AnyCPU的dll文件,该应用程序也构建为AnyCPU.

当我尝试在TestLaptop上测试我的应用程序时,它给了我一个错误:

Microsoft.ACE.OleDb.12.0提供程序未在您的计算机上注册.

所以我从TestLapTop卸载了Office并在BuildLapTop上安装了Office.

同样的错误.然后我尝试编译所有的dll以及我的应用程序到x64.该应用程序无法启动.然后我尝试只将应用程序编译为x64并将dll编译为anyCPU.错误再次发生.

那么帮助我如何让我的应用程序在TestLapTop上运行?

c# winforms

3
推荐指数
1
解决办法
1614
查看次数

打印不会从页面的上边缘开始

我正在尝试打印一些strings Graphicss.DrawString().我已设置边距printdocument但不是从页面的原点开始.我已margins(0,0,0,0),但不知它打印页面的顶部边缘低于一半厘米.另一件事是它可以从左边缘打印.

以下是我的代码.

private void button1_Click(object sender, EventArgs e)
    {
        ////PaperSize pkCustomSize1 = new PaperSize("First custom size", 1020, 3517);
        ////printDocument1.DefaultPageSettings.PaperSize = pkCustomSize1;
        printPreviewDialog1.Document = printDocument1;
        printDocument1.PrinterSettings.PrinterName = this.comboBox1.Text;
        Margins margins = new Margins(0, 0, 0, 0);
        printDocument1.PrinterSettings.DefaultPageSettings.Margins = margins;
        printPreviewDialog1.Show();
        printDocument1.Print();
    }

private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
    {
        int resX = GetPrinterResolutionX(comboBox1);
        int resY = PrnOpra.GetPrinterResolutionY(comboBox1);
        Graphics g = e.Graphics;

        float scale = resX / ScrnRes;
        Bitmap bm = new …
Run Code Online (Sandbox Code Playgroud)

.net c# printing winforms

3
推荐指数
1
解决办法
3257
查看次数

在 RDLC 中添加多个表

正如问题所述,我想在 RDLC 报告中添加多个表格。我在几份报告中添加了一张表格。但是不知道如何在一个报表中添加多个表。我正在使用objectsas添加表格DataSource。我的数据库是SQLite.

我发现了一个教程,使rdlc使用object作为datasource 在这里。但这并不能说明多个表。怎么做?

.net c# sqlite rdlc dynamic-rdlc-generation

3
推荐指数
1
解决办法
7683
查看次数

&amp; 代替 &amp; 在 STUFF FOR XML PATH 中

我正在使用STUFF功能。我有一些条目具有&但显示& ; 反而。我在某处读到 & 保留在 XML 中。如何解决这个问题。

...STUFF((SELECT (', ' + CategoryName) FROM CategoryTable WHERE CategoryId IS NOT NULL AND CategoryId IN (1,2,3) FOR XML PATH('')), 1, 1, '') as CategoryName,...
Run Code Online (Sandbox Code Playgroud)

以上是我的查询(好吧,我刚刚添加了完整查询的一部分。)。怎么解决。谢谢。

sql sql-server

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

物业正在制造麻烦

在我的应用程序中,我添加了一个Properties.cs文件,其中包含我将在整个应用程序中使用的属性.我得到NullReferenceException =>Object reference not set to an instance of an object.

这是Properties.cs的代码

public class Properties
{
    private static string type1;

    public static string Type1
    {
        get
        {
            return type1;
        }
        set
        {
            type1= value;
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

当我以我的一个表单访问此属性时,我收到错误.例如

if (Properties.Type1.Equals(string.Empty) || Properties.Type1.Equals(null))
{
    // Do something
}
Run Code Online (Sandbox Code Playgroud)

c# winforms

0
推荐指数
1
解决办法
82
查看次数

c#检查字符串中是否重复"*"

我正在计算我的字符串中有多少*符号.但我得到一个错误.

System.dll中出现未处理的"System.ArgumentException"类型异常

我只是使用正则表达式匹配来检查它.当我用任何其他字符串进行测试时,它工作得很好,但是当我搜索"*"时,它是一个例外.

这是给出表达式的代码

string abc = "i am just trying *** for a sample code";
var count = Regex.Matches(abc, "*").Count;
Console.Out.WriteLine(count);
Run Code Online (Sandbox Code Playgroud)

这一个很完美

string abc = "i am just trying  for a sample code";
var count = Regex.Matches(abc, "a").Count;
Console.Out.WriteLine(count);
Run Code Online (Sandbox Code Playgroud)

任何想法为什么?

.net c#

-4
推荐指数
2
解决办法
135
查看次数