小编use*_*156的帖子

找不到如何使用HttpContent

我正在尝试使用HttpContent:

HttpContent myContent = HttpContent.Create(SOME_JSON);
Run Code Online (Sandbox Code Playgroud)

...但我没有运气找到定义它的DLL.

首先,我尝试添加引用Microsoft.Http以及System.Net,但是列表中都没有.我也尝试添加一个引用,System.Net.HttpHttpContent该类不可用.

那么,谁能告诉我在哪里可以找到这门HttpContent课程?

.net c# asp.net dll

165
推荐指数
4
解决办法
20万
查看次数

检查控件类型

我能够在打印它显示的页面中获取页面的所有控件的ID以及它们的类型

myPhoneExtTxt Type:System.Web.UI.HtmlControls.HtmlInputText
Run Code Online (Sandbox Code Playgroud)

这是基于此代码生成的

    foreach (Control c in page)
    {
        if (c.ID != null)
        {
            controlList.Add(c.ID +" Type:"+ c.GetType());
        }
    }
Run Code Online (Sandbox Code Playgroud)

但现在我需要检查它的类型并访问其中的文本,如果它的类型为HtmlInput,我不太清楚如何做到这一点.

喜欢

if(c.GetType() == (some htmlInput))
{
   some htmlInput.Text = "This should be the new text";
}
Run Code Online (Sandbox Code Playgroud)

我怎么能这样做,我想你明白了吗?

c# asp.net casting interface

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

如何隐藏或显示div

我在我的Page_Load上注册了这个

 Page.ClientScript.RegisterStartupScript(this.GetType(), "clientscript", "document.getElementById('showdiv').style.visibility = 'hidden';", true);
Run Code Online (Sandbox Code Playgroud)

但它没有被隐藏......我的div如下所示

<div id="showdiv">
   <input class="button" type="button" value="OK" name="success_button" id="my button"  onclick="javascript:window.close();" />
   </div>
Run Code Online (Sandbox Code Playgroud)

我究竟做错了什么?.谢谢您的帮助

javascript c# asp.net

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

如何使用XDocument获取值

我有这个xml,我试图<ErrorCode>在调查后尝试获取节点中的值,我发现使用XDocument更容易,因为它清除了任何不需要\r\n的来自api的响应给了我..但是现在我不知道如何使用XDocument检索该值

<PlatformResponse xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://platform.intuit.com/api/v1">
  <ErrorMessage>OAuth Token rejected</ErrorMessage>
  <ErrorCode>270</ErrorCode>
  <ServerTime>2012-06-19T03:53:34.4558857Z</ServerTime>
</PlatformResponse>
Run Code Online (Sandbox Code Playgroud)

我希望能够利用这个调用获得价值

 XDocument xmlResponse = XDocument.Parse(response);
Run Code Online (Sandbox Code Playgroud)

我不能使用XmlDocument,因为它不会清理XML,因为它正在执行XDocument

谢谢

c# asp.net linq-to-xml

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

标签 统计

asp.net ×4

c# ×4

.net ×1

casting ×1

dll ×1

interface ×1

javascript ×1

linq-to-xml ×1