问题列表 - 第45981页

如何在运行时从Display(Name =)DataAnnotation获取强类型列表支架视图的列标题?

如何[Display(Name="Some Title")]在List scaffold视图的输出中获取DataAnnotations"Some Title"?

我为这个类创建了一个强类型列表支架视图:

public class CompanyHoliday
{
    [Key]
    public int Id { get; set; }

    [Required]
    [Display(Name = "Datum")]
    [DataType(System.ComponentModel.DataAnnotations.DataType.Date)]
    public DateTime Date { get; set; }

    [Required]
    [StringLength(50)]
    [Display(Name = "Feiertag Name")]
    public string Name { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

该视图如下所示:

@model IEnumerable<Zeiterfassung.Domain.CompanyHoliday>

@{
    ViewBag.Title = "Year";
}

<h2>Year</h2>

<p>
    @Html.ActionLink("Create New", "Create")
</p>
<table>
<tr>
    <th></th>
    <th>
        Date
    </th>
    <th>
        Name
    </th>
</tr>

@foreach (var item in Model) {
<tr>
    <td>
        @Html.ActionLink("Edit", "Edit", new …
Run Code Online (Sandbox Code Playgroud)

asp.net-mvc razor asp.net-mvc-3

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

什么是Java中面向组件的编程?

我需要学习Java中面向组件的编程,我相信这与EJB有关,但我不确定...这是真的吗?

请问您能给我一些与Java中面向组件编程相关的链接,以便有一个关于它的起点吗?

谢谢 !

java ejb terminology

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

DataRow的通用字段getter

我尝试使用此通用方法扩展DataRow对象:

public static T? Get<T>(this DataRow row, string field) where T : struct
{
  if (row.IsNull(field))
    return default(T);
  else
    return (T)row[field];
}
Run Code Online (Sandbox Code Playgroud)

它的做工精细当T int,decimal,double,等.

但是当我尝试使用字符串时,我有这个错误:

"类型'字符串'必须是不可为空的值类型,以便在泛型类型或方法'System.Nullable'中将其用作参数'T'"

我怎么能纠正这个?

我知道字符串不是结构,但如果字符串字段是DBNull,我不会返回null.

c# generics ado.net extension-methods datarow

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

图像旋转的Jquery包含问题

大家好.我使用下面的代码来旋转拖放图像.旋转工作正常,但是当我开始旋转时,图像移动到"div"容器之外.我想念的东西.

    //Moving outside the container for first time.After dragging inside the div,then rotates inside the div
  var test = 5;
  var mouseDown = false;
  $(function() {
      $('.frame').mousedown(function(e) { mouseDown = true; });
      $('.frame').mouseup(function(e) { mouseDown = false; });
      $('.frame .rotatable').live('mousemove', function(e) {
          if ((mouseDown) && (e.ctrlKey)) {

              test = test + 10;
              var currentId;
              document.getElementById('angle').value = test;
              $(this).rotate({ angle: test });
              var currentId = $(this).attr('id');
              var id = currentId.substring(8);                  
              var deleteimage = 0;
              var angle = test;
              saveCoords(e.clientX, e.clientY, angle, …
Run Code Online (Sandbox Code Playgroud)

jquery

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

签署应用程序,但不在Android市场上发布

Android系统有一个名为"Unknown Sources"的标志,允许它从非市场来源安装应用程序.

如果我按照Android开发者网站上的描述签署我的应用程序(即使用我从谷歌获得的私钥创建的证书),并决定不在Android市场上发布我的应用程序,而是在我自己的网站上托管它.

这个应用程序会被android系统视为非市场吗?它是否仍会在关闭"未知来源"选项的情况下安装?

android signing publishing google-play

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

如何配置git help以使用Firefox?

我在Windows机器上使用Git,git bash总是使用Web版本寻求帮助.我真的很喜欢这个,我想在我的Mac上做同样的事情.

我跑了:

$ git config --global help.format web
$ git config --global web.browser firefox
Run Code Online (Sandbox Code Playgroud)

并且help命令的输出是:

$ The browser firefox is not available as 'firefox'.
Run Code Online (Sandbox Code Playgroud)

我然后设置:

$ git config --global browser.firefox.path /Applications/Firefox.app/Contents/MacOS/firefox-bin
Run Code Online (Sandbox Code Playgroud)

由于我通常打开firefox,它现在哭了:

Firefox的副本已经打开.一次只能打开一份Firefox.

我想要git使用的真正命令是open -a Firefox.app somefile.我试着设置browser.firefox.cmd无济于事.

我的问题:如何配置git以使用web版本并以一种不会导致问题的方式调用/使用firefox,如果它已经打开了?

git macos firefox

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

WPFToolkit DataGrid:突出显示修改的行

有没有办法突出显示 a 上所有修改的行DataGrid?由于网格绑定到 aSystem.Data.DataTable我想我也许能够将每行的颜色绑定到它RowState(下面的示例),但这似乎不起作用。

有任何想法吗?

xmlns:data="clr-namespace:System.Data;assembly=System.Data"
<Style x:Key="DataGridRowStyle" TargetType="{x:Type toolkit:DataGridRow}">
    <Style.Triggers>
        <Trigger Property="IsSelected" Value="true">
            <Setter Property="Background" Value="Blue" />
        </Trigger>
        <DataTrigger Binding="{Binding RowState}"
                     Value="{x:Static data:DataRowState.Modified}">
            <Setter Property="Background" Value="LightYellow" />
        </DataTrigger>
    </Style.Triggers>
</Style>
Run Code Online (Sandbox Code Playgroud)

c# wpf datagrid wpftoolkit

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

android web视图中的动态进度条

您好我如何在其中添加页面加载进度.当页面加载完全然后prgress栏应该向上.我想把代码放在case语句中.提前致谢 .这是代码

package com.menu;

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Toast;

public class MenuActivity extends Activity {
WebView mWebView;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    mWebView = (WebView) findViewById(R.id.webview);
    mWebView.getSettings().setJavaScriptEnabled(true);
    mWebView.loadUrl("http://www.google.com");
    mWebView.setWebViewClient(new WebViewClient());
}
public boolean onCreateOptionsMenu(Menu menu) {
    new MenuInflater(getApplication())
            .inflate(R.layout.menu, menu);
    return(super.onPrepareOptionsMenu(menu));
}

public boolean onOptionsItemSelected(MenuItem item) {
     switch (item.getItemId()) {
        case R.id.Menu1:
            WebView myWebView = (WebView) findViewById(R.id.webview); …
Run Code Online (Sandbox Code Playgroud)

android

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

C++:malloc是否相当于new?

可能重复:
new/delete和malloc/free有什么区别?

大家好我是c ​​++的菜鸟,想知道是否

memblock = (char *)malloc( currentByteLength); 
Run Code Online (Sandbox Code Playgroud)

相当于

memblock = new char[currentByteLength]
Run Code Online (Sandbox Code Playgroud)

在c ++中.

c++

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

设置http标头RSpec 2.4/Rails 3

我开始使用RSpec了.我有一个新的rails 3应用程序,它使用HTTP_ACCEPT_HEADER或请求2个字母的子域来设置应用程序语言并相应地重定向.我使用Cucumber成功测试了我的重定向代码.

现在我想编写我的控制器规范,我需要在测试之前设置请求子域.

在我的黄瓜步骤中,我可以指定:

header 'HTTP_HOST', 'es.mysite.local'
visit '/'
Run Code Online (Sandbox Code Playgroud)

但是当我尝试在spec文件中执行此操作时

header 'HTTP_HOST', 'es.mysite.local'
get 'index'
Run Code Online (Sandbox Code Playgroud)

我收到此错误:

Failure/Error: header 'HTTP_HOST', "es.mysite.local"
 LoadError:
   no such file to load -- action_controller/integration
Run Code Online (Sandbox Code Playgroud)

关于如何解决这个问题的任何线索?

rspec ruby-on-rails webrat cucumber

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