小编Pom*_*ter的帖子

我可以使用没有定时器组件的定时器吗?

我正在使用Windows服务而且它们很难测试,所以我希望尽可能将它留空,只能导入类.

我需要每5分钟使用一个Timer来触发和事件,但如果我使用计时器组件,我必须将它放在我的Windows服务上.

那么有可能建立我自己的基本计时器类??

我怎么会这样呢?我想要非常小而轻,如果可能的话几行代码.

.net c# windows-services timer

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

用按钮打开一个新窗口?

我需要打开一个新窗口进行打印,有人可以告诉我该怎么做吗?

我的按钮点击代码:

我的 window.location 有效,但不能使用 window.open

$('.btnFromIndexPrint').click(function () {
    if (document.URL.indexOf('index') > -1) {
         // window.location = '../Print/' + $(this).attr('id');
         window.open = '../Print/' + $(this).attr('id');
    } else {
        //window.location = 'Contract/Print/' + $(this).attr('id'); //Redirect  from Index page to print action
        window.open = 'Contract/Print/' + $(this).attr('id');
    }

});
Run Code Online (Sandbox Code Playgroud)

我的html:

我知道有一种叫做 target ="blank" id 的东西不认为它会起作用。

<input type="button" value="Print" class="btnFromIndexPrint" id="@item.SalesContractId"/>
Run Code Online (Sandbox Code Playgroud)

我将如何在新页面上打开重定向?

重要的!!!!!!!

return RedirectToAction("Print", new { id = contractInstance.SalesContractId });
Run Code Online (Sandbox Code Playgroud)

asp.net-mvc jquery new-window

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

什么是的codeURI值?

请问有人请告诉我换行符的CodeURI值是多少?()

如果你看下面的评论测试,你会看到我想要实现的目标.

public static string unescapeForEncodeUriCompatability(string str) {
      return str.Replace("%21", "!").Replace("%7e", "~")
          .Replace("%27", "'").Replace("%28", "(").Replace("%29", ")")
          .Replace("%3b", ";").Replace("%2f", "/").Replace("%3f", "?")
          .Replace("%3a", ":").Replace("%40", "@").Replace("%26", "&")
          .Replace("%3d", "=").Replace("%2b", "+").Replace("%24", "$")
          .Replace("%2c", ",").Replace("%23", "#"); //test .Replace("¶"," ")
    }
Run Code Online (Sandbox Code Playgroud)

javascript c#

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

在数据集中显示数据?

我正在尝试查看a中的数据Dataset,我不介意它是什么视图,我可以将其打印出来text file或显示在一个Datagrid我只是试图发现什么方面.我正在测试一个Web服务,看它是否返回结果,我让它返回一个Dataset.

ServiceReference1.PropertiesSoapClient ws1 = new ServiceReference1.PropertiesSoapClient();
            ws1.Open();

 DataSet datasetprint = new DataSet();
            if (ws1 != null)
            {
                ServiceReference1.ReturnValuationRequest request = new ServiceReference1.ReturnValuationRequest(UserID, trackingNumber);
                ServiceReference1.ReturnValuationResponse response = ws1.ReturnValuation(request);
                if (response.ReturnValuationResult != null)
                {
                    DataSet ds = response.ReturnValuationResult;
                    datasetprint = ds;            
                }
            }
Run Code Online (Sandbox Code Playgroud)

什么是我查看其内容的最佳方式?


编辑:

我不希望不只是把断点视为无穷无尽的数据,这是没有意义的.

在此输入图像描述

我更喜欢在数据网格中甚至在文本文件中查看它.

c# web-services dataset

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

用C#代码删除文件夹?

我想删除一个文件夹,但我可以设法把它弄好吗?

我想删除的文件夹名为ExtractedFiles,它位于名为FormValue的文件夹中.

我可以删除同一FormValue文件夹中的电子表格,但无法删除该文件夹.

我认为问题可能是我没有正确的文件夹文件扩展名

这有效:

if (File.Exists(tempFolderPathAlt + saveas + ".xls"))
            {
                File.Delete(tempFolderPathAlt + saveas + ".xls");
            }
Run Code Online (Sandbox Code Playgroud)

这不起作用:

 if (File.Exists(tempFolderPathAlt + "ExtractedFiles"))
            {
                File.Delete(tempFolderPathAlt + "ExtractedFiles");
            }
Run Code Online (Sandbox Code Playgroud)

有人可以告诉我文件夹的文件扩展名或如何删除文件夹?

c#

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

预期方法名称?

我有一个 asp 按钮,我想在其中链接到 javascript 方法。

<ICCM:ICCMImageButton ID="btnClose" runat="server" meta:resourcekey="btnResClose" TabIndex="9" OnClick="CloseIFrame()"/>

<script language="javascript" type="text/javascript">
    function CloseIFrame() {
        alert("close");
    }
</script>
Run Code Online (Sandbox Code Playgroud)

我也在准备好的j查询文档中尝试过这个功能,但这没有效果。

在我的 C# 中,我添加了页面加载:

Page.Header.DataBind();
btnClose.Attributes.Add("OnClick", "CloseIFrame();");
Run Code Online (Sandbox Code Playgroud)

当我尝试运行我的项目时,我得到了预期的错误方法名称。这将我指向我的按钮所在的行。

这是我得到的所有信息,我错过了什么吗?

javascript c# asp.net jquery

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

如何将C#列表插入Div?

我有一个C#列表:

List<string> Listtags =  GetListTag.GetTagList().ToList();
Run Code Online (Sandbox Code Playgroud)

而且,我想把它变成一个Div:

<div id="tags">
    <ul>
        <li><This should be populated with my list></li>
         //This list can have any number of items depending on how big my list tags is
    </ul>
</div>
Run Code Online (Sandbox Code Playgroud)

有人能告诉我怎么做吗?

c# asp.net webforms list

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

我想隐藏一个DIV?

我是jQuery使用Div作为对话框,但在调用对话框之前,Div显示在我的屏幕底部.

我怎么能隐藏这个div?

<div id = "PrintDialog" title="Warning">
        <p>Once you print, no changes may be made to this contract. Are you sure you want to print?</p>
        <input type="button" value="Print" id="btnDialogPrint" />
        <input type="button" value="Cancel" id="btnDialogCancel" />
        </div>
Run Code Online (Sandbox Code Playgroud)

我想仍然使用Div,只是没有显示它,除非它的对话框.

提前致谢.

html asp.net jquery

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

我想创建一个事件处理程序

可能重复:
为OnScroll创建事件处理程序以进行Web浏览器控制

我想为Web浏览器控件滚动创建一个事件处理程序.

webCompareSQL.Document.Window.Scroll
Run Code Online (Sandbox Code Playgroud)

有人可以告诉我如何创建一个事件处理程序?

c# event-handling

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

XML文档处理无法加载文件

我正在编写一个应用程序,我需要从XML文档中提取信息.

我的XML文档存储在我的项目bin/Debug文件中.

我不能让它工作.

名为informationData的XML文档:

<xml>
<information>
<name >stian</name>
<surname>Kruger</surname>
<tel>0825514302</tel>
<photo>1234JLJ.jpg</photo>
</information>
</xml>
Run Code Online (Sandbox Code Playgroud)

我的电话代码:

private void btnReadXML_Click(object sender, EventArgs e)
        {
            XmlDocument xmlDoc = new XmlDocument();
            xmlDoc.Load("informationData.xml");

            XmlNodeList dataNodes = xmlDoc.SelectNodes("/information");

            foreach (XmlNode node in dataNodes)
            {
                Name = node.SelectSingleNode("name").InnerText;
                Surname = node.SelectSingleNode("surname").InnerText;
                TelNumber = Convert.ToInt32(node.SelectSingleNode("tel").InnerText);

            }
        }
Run Code Online (Sandbox Code Playgroud)

c# xml

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