小编Bhu*_*ake的帖子

如何在运行时更改按钮的背景图像?

我遇到了问题.我想在运行时更改按钮的背景图像.我得到了改变颜色的解决方案,但我想改变图像.

代码如下

public void buttonCase(object sender, RoutedEventArgs e)
{
    Uri uri = null;
    var image = new ImageBrush();
    if (((App)App.Current).appControler.m_Mode == Controller.textMode.Letters)
    {
        ((App)App.Current).appControler.buttonCase(sender, e);
        switch (((App)App.Current).appControler.m_case)
        {
        case Controller.caseMode.Upper:
            b0.FontSize = b1.FontSize = b2.FontSize = b3.FontSize = b4.FontSize = b5.FontSize = b6.FontSize = b7.FontSize
            = b8.FontSize = b9.FontSize = bCornerLower.FontSize = 30.0;
            uri = new Uri(@"/SourceCode;component/Images/Lower_Case_p.png", UriKind.Relative);
            image.ImageSource = new BitmapImage(uri);
            btnCase.Background = image;
            break;
        case Controller.caseMode.Lower:
            b0.FontSize = b1.FontSize = b2.FontSize = b3.FontSize = b4.FontSize = b5.FontSize = …
Run Code Online (Sandbox Code Playgroud)

.net c# silverlight xaml windows-phone-7

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

ASP.NET MVC 4自定义HTML Helpers文件夹位置

我开始使用带有Razor语法的ASP.NET MVC 4框架开发应用程序.我想知道我应该在哪里(文件夹位置)创建我的HTML Helper类.最佳实践.

例如:

  • VisualStudioSolution
    • Controlles
    • HTML
      • HtmlHelperClass.vb
    • 楷模
    • 查看

asp.net html-helper asp.net-mvc-4

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

从iframe访问父窗口元素

  • 我有一个customer.jsp页面iframe.
  • iframe有一个按钮.点击按钮,我需要访问customer.jsp页面内的对话框.
  • 我尝试过,window.parent.document.getElementById('formDialog');但我正在获得null价值.

javascript iframe

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

mvc中的自定义错误页面

我需要使用customerror来显示错误页面 web.config

但是watever错误可能是,即使在web.config我指定了一些版本错误也需要显示错误页面,

我怎样才能做到这一点.我试过但是url重定向到

"http://localhost:1966/Error.html?aspxerrorpath=Error.html"
Run Code Online (Sandbox Code Playgroud)

CustomError标签:

<customErrors mode="On" defaultRedirect="Error.html" />
Run Code Online (Sandbox Code Playgroud)

并显示来自mvc的另一个错误页面,而不是地雷.

asp.net-mvc

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

CSS UL/LI菜单不居中

我的CSS UL菜单似乎不想中心,任何想法?我已粘贴下面的代码供您查看,我对CSS很新,所以非常感谢您的帮助:-)

我能够居中的唯一方法是通过固定宽度和使用html中心标签,但我需要菜单100%进行扩展,我需要自动居中.

CSS

#menu{
    width:100%;
    margin: 0;
    padding: 5px 0 0 0;
    list-style: none;
    background-color:#333333;
    text-align:center;
}

#menu li{
    float: left;
    padding: 0 0 5px 0;
    position: relative;
    list-style:none;
    margin:auto;
}

#menu ul{
        list-style:none;
        display:inline;
        margin: 0;
        padding: 0;
        text-align: center;
}

#menu a{
    float: left;
    height: 15px;
    padding: 0 25px;
    color:#FFF;
    text-transform: uppercase;
    font: 10px/25px Arial, Helvetica;
    text-decoration: none;
    text-shadow: 0 0px 0 #000;
}


#menu li:hover > a{
    color:#F90;

    font: bold 10px/25px Arial, Helvetica;
}

*html #menu …
Run Code Online (Sandbox Code Playgroud)

css html-lists

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

如何获取数组中类的属性

我有一个学生班,结构如下:

    public sealed class Student
    {
       public string Name {get;set;}
       public string RollNo {get;set;}
       public string standard {get;set;}
       public bool IsScholarshipped {get;set;}
       public List<string> MobNumber {get;set;}
    }
Run Code Online (Sandbox Code Playgroud)

如何在类似数组中获取Student类的这些属性

     arr[0]=Name;
     arr[1]=RollNo; 
      .
      .
      .
     arr[4]=MobNumber
Run Code Online (Sandbox Code Playgroud)

并且这些属性的类型在单独的数组中

     arr2[0]=string;
     arr2[1]=string;
      .
      .
      .
     arr2[4]=List<string> or IEnumerable
Run Code Online (Sandbox Code Playgroud)

请用大块代码解释一下.

c#

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

在MVC4和类库之间共享会话的最佳方式

背景:

ASP.NET会话状态使您能够在用户在Web应用程序中导航ASP.NET页面时存储和检索用户的值.这适用于该应用程序但是当我们在该应用程序中引用了一个类库并且我们需要Session Variables在该库中时,我必须将它传递给每个方法,因为我没有使用依赖注入.

问题:

我有一个控制器,它进行Facebook身份验证如下:

 public class FacebookController : Controller
    {
        private FacebookGateway FacebookGateway = new FacebookGateway();

        // GET: /Facebook/

        public ActionResult Index()
        {
            string code = Request.QueryString["code"];
            TokenResponse tokenResponse = FacebookGateway.GetTokenResponse(code);
            Session["AccessToken"] = tokenResponse.Access_token;
            return View();
        }

        public ActionResult Friends()
        {

            string accessToken = Session["AccessToken"].ToString();

            WebRequest request = WebRequest.Create(instanceUrl + @"profileUrl-Here");
            request.Method = "GET";
            request.Headers.Add("Some Header " + accessToken);
            WebResponse response = request.GetResponse();
            string str = String.Empty;

            if (response == null)
            {
            }
            else
            {
                using (StreamReader …
Run Code Online (Sandbox Code Playgroud)

c# asp.net session-variables asp.net-mvc-4

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

获取Redis中列条目的总和

我们如何获取NO-SQL数据库Redis中列条目的总和?

我的意思是类似于:

    Select sum(salary) from Account;
Run Code Online (Sandbox Code Playgroud)

redis servicestack

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

C#将天数转换为时间hh:mm

同时计算所有跨度的总和它显示导致天(dd:HH:mm)。问题是我如何只获取和HH:mmformat.how我的天转换成小时

          TimeSpan Span1 = TimeSpan.Parse(mnts1);
          TimeSpan Span2 = TimeSpan.Parse(tuts1);
          TimeSpan Span3 = TimeSpan.Parse(wdts1);
          TimeSpan Span4 = TimeSpan.Parse(thts1);
          TimeSpan Span5 = TimeSpan.Parse(frts1);
          TimeSpan Span6 = TimeSpan.Parse(stts1);
          TimeSpan Span7 = TimeSpan.Parse(suts1);
          TimeSpan  rf = Span1 + Span2 + Span3 + Span4 + Span5 + Span6 + Span7; 
Run Code Online (Sandbox Code Playgroud)

c#

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

添加新用户以使用ASP.NET Membership类

我使用vs2012 express版构建webform应用程序.
配置SqlMembership提供程序以将用户凭据存储到我的Sqlserver数据库后,我想创建用户用户但我收到此错误:无法声明类型为'System.Web.Security.Membership的变量.
我花了两个小时谷歌搜索仍然没有决议.这是我的代码

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security.Membership;
//using Microsoft.AspNet.Membership.OpenAuth;

namespace Practice_project.Account
{
public partial class Register : Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        //RegisterUser.ContinueDestinationPageUrl = Request.QueryString["ReturnUrl"];
    }

   public void RegisterUser_CreatedUser(object sender, EventArgs e)
    {


        Membership Create_New_User = Membership.CreateUser(UserName, Password);

    }
}
}
Run Code Online (Sandbox Code Playgroud)

c# asp.net

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