我需要在c#中获取代码背后的javascript值.我知道我可以使用隐藏字段,但页面上没有用于回发的服务器控件.请告诉我如何在代码中获取代码.
这是我的代码:
<html>
<head>
<title>Facebook Get Logged in User Details UserName,Email,Profile Image</title>
<script src="jquery-1.6.2.min.js" type="text/javascript"></script>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>
<script>
// Load the SDK Asynchronously
(function (d) {
var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
if (d.getElementById(id)) { return; }
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js";
ref.parentNode.insertBefore(js, ref);
} (document));
// Init the SDK upon load
window.fbAsyncInit = function () {
FB.init({
appId: 'APPID', // App ID
channelUrl: '//' + window.location.hostname + …Run Code Online (Sandbox Code Playgroud) 我想在我的Windows 8移动应用程序中从Web颜色值设置边框背景颜色.
我找到了一种方法将十六进制转换为Argb,但它不适用于我..
private System.Windows.Media.Color FromHex(string hex)
{
string colorcode = hex;
int argb = Int32.Parse(colorcode.Replace("#", ""), System.Globalization.NumberStyles.HexNumber);
return System.Windows.Media.Color.FromArgb((byte)((argb & -16777216) >> 0x18),
(byte)((argb & 0xff0000) >> 0x10),
(byte)((argb & 0xff00) >> 8),
(byte)(argb & 0xff));
}
Run Code Online (Sandbox Code Playgroud)
我正在使用上面的方法..
Border borderCell = new Border();
var col = FromHex("#DD4AA3");
var color =new System.Windows.Media.SolidColorBrush(col);
borderCell.Background = color;
Run Code Online (Sandbox Code Playgroud)
但是,如果我传递颜色十六进制值如下
var col = FromHex("#FFEEDDCC");
Run Code Online (Sandbox Code Playgroud)
它的工作正常,但它不适用于我的十六进制颜色值.
在发布这个问题之前,我通过这个堆栈答案. 如何使用.NET从十六进制颜色代码中获取颜色?
我有两个第一个说国家
country_id country _name
1 India
2 Australia
3 Netherlands
the 2nd table is states
state_id country state name
1 2 abc
2 2 xyz
3 3 pqr
4 1 lmn
5 1 rst
Run Code Online (Sandbox Code Playgroud)
其中,country_id在第一个表是在第二个表中的国家,所以现在我想要两个下拉菜单一个国家与另一个国家的状态.第二个下拉值必须根据第一个下拉列表中的所选项目进行更改,并且只要未选中第一个下拉列表中的项目,就必须禁用第二个下拉列表
假设我有一个名为"ABC"的类
Class ABC:IDisposable
{
public string name {get;set;}
public string Method1()
{
// Implements
}
//end of class
}
Run Code Online (Sandbox Code Playgroud)
我从其他人那里听说你应该使用always inherit IDisposable来释放内存创建上面类的对象,如下所示:
using(ABC objABC = new ABC())
{
objABC.Method1();
}
Run Code Online (Sandbox Code Playgroud)
但是还有其他方法可以调用和使用Eg的上面的类和方法
private string testmethods()
{
ABC objABC = new ABC();
string test = objABC.Method1();
// I want to know this above `objABC` 's memory is free after finish `testmethods()`?
// we can also call using this like below
string test2 = new ABC().Method1();
}
Run Code Online (Sandbox Code Playgroud)
我想知道哪种方法最好?
我也想知道的是,对象内存是在testmethods()通话结束后自动清除的吗?