很抱歉,如果已经回答了这个问题,但我找不到合适的答案.我在C#中有一个字符串表达式,我需要将其转换为int或decimal值.
例如:
string strExp = "10+20+30";
Run Code Online (Sandbox Code Playgroud)
输出应为60.
我该怎么办?
无论如何,我可以做到这一点,所以页面将在内容加载后自动滚动到顶部(通过Ajax)?
这是我显示内容的代码:
$(document).ready(function () {
var my_layout = $('#container').layout();
$("a.item_link").click(function () {
$("#loader").fadeIn();
feed_url = $(this).attr("href");
$.ajax({
type: "POST",
data: "URL=" + feed_url,
url: "view.php",
success: function (msg) {
$("#view-area").html(msg);
$("#loader").fadeOut();
}
});
return false;
});
});
Run Code Online (Sandbox Code Playgroud)
所以在'view-area'加载了它的内容后,我可以让页面自动滚动到顶部吗?
我正在阅读MSDN中的这个UpdateLayout()方法.
它说:
确保为布局正确更新此元素的所有可视子元素.
但我不明白布局没有正确更新是什么意思.
我已经使用Silverlight/WPF超过一年了,但我还没有使用过这种方法一次.
那么有人可以给我一个需要使用这种方法的例子吗?所以我真的能理解它的作用以及何时使用它?
我看过很多帖子,展示了如何滚动到ListBox的底部项目,但无法解决如何自动滚动到列表框的顶部.如果我向下滚动列表框,然后使用我的过滤器功能,列表框将保持在您向下滚动的位置,因此用户可能看不到上下滚动到的位置的结果.
我一直在尝试使用listbox.ScrollIntoView但无法获得正确的功能.这是它的背景......(评论部分):
private void filter_Click(object sender, RoutedEventArgs e)
{
string filterString = textBox1.Text;
XElement _xml = XElement.Load("1/1.xml");
{
results.Items.Clear();
foreach (XElement value in _xml.Elements("Operators").Elements("Operator"))
{
1Item _item = new 1Item();
_item.TradingName = value.Element("TradingName").Value;
if (_item.Town.IndexOf(filterString, 0, StringComparison.CurrentCultureIgnoreCase) != -1)
{
results.Items.Add(_item);
// add scroll function here
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
非常感谢.
我有一个5列的datagridview,当我按"enter"它进入下一个单元格,当它到达行的末尾,当我按Enter键它添加一个新的行,但我的问题是当我移动到上一个我按下后输入它跳行,不会去下一个单元格,任何帮助?
public partial class Form1 : Form
{
public static int Col;
public static int Row;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
dataGridView1.AllowUserToAddRows = false;
dataGridView1.Rows.Add();
}
private void dataGridView1_CellEnter(object sender, DataGridViewCellEventArgs e)
{
Col = dataGridView1.CurrentCellAddress.X;
Row = dataGridView1.CurrentCellAddress.Y;
}
private void Form1_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == (int)Keys.Enter)
{
if (Col + 1 < 5)
{
dataGridView1.CurrentCell = dataGridView1[Col + 1, Row];
}
else
{
dataGridView1.Rows.Add();
dataGridView1.CurrentCell = dataGridView1[Col - …Run Code Online (Sandbox Code Playgroud) 我正在尝试运行一个简单的WCF服务......
我的Wcf服务.config:
<system.serviceModel>
<services>
<service name ="WebService.Receptor">
<endpoint
address = "http://MyServer:8000/WS"
binding = "wsHttpBinding"
contract = "IMyContract"
/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
Run Code Online (Sandbox Code Playgroud)
我的Windows服务.config:
<system.serviceModel>
<client>
<endpoint
name = "Receptor"
address = "http://MyServer:8000/WS"
binding = "wsHttpBinding"
contract = "IMyContract"
/>
</client>
</system.serviceModel>
Run Code Online (Sandbox Code Playgroud)
Obs:Wcf服务在Windows 7上的IIS 7.5下运行.
所以,当我尝试从wcf代理(IMyContract)调用方法时,我收到此错误:
在http:// MyServer:8000/WS上没有可以接受该消息的端点.这通常是由错误的地址或SOAP操作引起的.有关更多详细信息,请参阅InnerException(如果存在).
内在的例外:
{"无法连接到远程服务器"}
谁知道为什么?
当我用鼠标输入标签时,我需要使标签下划线.我怎样才能做到这一点?我尝试了几个选项,但它没有用.谁能告诉我怎么做?
我有以下代码:
foreach (Logs log in _logsDutyStatusChange)
{
string driverid = log.did;
}
Run Code Online (Sandbox Code Playgroud)
我怎么只在driverid字符串中添加不同的驱动程序ID?
谢谢
让ASP.NET MVC3绑定包含列表的复杂JSON对象时遇到问题.
这是我对象的结构.
public class PageModel
{
public PageModel() { }
public CustomObject1 CustomObject { get; set; }
public IEnumerable<CustomObject2> Objects { get; set; }
}
public class CustomObject1
{
public CustomObject1() { }
[Required]
public int CustomId1 { get; set; }
public string CustomName { get; set; }
}
public class CustomObject2
{
public CustomObject2() { }
[Required]
public int Custom2Id { get; set; }
public CustomObject3 SubItem { get; set; }
public int SubItemId { get; set; } …Run Code Online (Sandbox Code Playgroud) 我有点击事件的监听器,我需要从中排除一些元素.
现在我的列表正在增长,所以我正在寻找一种更好的方法来"捆绑"选择器中的多个元素.
这就是我所拥有的:
$(document).on('click tap', function(event) {
if ($(event.target).closest('div:jqmData(panel="popover")').length > 0 ||
$(event.target).closest('div.pop_menuBox').length > 0 ||
$(event.target).closest('.toggle_popover').length > 0 ) ||
$(event.target).closest('.ui-selectmenu').length > 0 {
return;
}
// do stuff
});
Run Code Online (Sandbox Code Playgroud)
有没有更好的方法来排除这些元素?
感谢帮助!