问题列表 - 第16711页

C#按钮单击

我在.aspx页面上有以下按钮:

<asp:Button runat="server" ID="bntLogin" OnClick="bntLogin_Click" Text="Login" />
Run Code Online (Sandbox Code Playgroud)

使用.aspx.cs中的以下内容:

protected void bntLogin_Click(object sender, EventArgs e)
        {
           //
        }
Run Code Online (Sandbox Code Playgroud)

当我尝试构建它时,我收到以下错误:

'ASP.reserve_aspx'不包含'bntLogin_Click'的定义,并且没有扩展方法'bntLogin_Click'可以找到类型'ASP.reserve_aspx'的第一个参数(你是否缺少using指令或程序集引用?)

但是,当我将click事件从代码隐藏移动到它构建的标记内的脚本块时.

有任何想法吗?

c# asp.net events click button

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

如何在应用程序设置中存储int []数组

我正在使用C#express 2008创建一个简单的Windows窗体应用程序.我是一位经验丰富的C++开发人员,但我对C#和.NET几乎全新.

我目前正在使用设置设计器和代码存储我的一些简单应用程序设置,如下所示:

// Store setting  
Properties.Settings.Default.TargetLocation = txtLocation.Text;  
...  
// Restore setting  
txtLocation.Text = Properties.Settings.Default.TargetLocation;  
Run Code Online (Sandbox Code Playgroud)

现在我想存储一个ints(int[])数组,或者可能存储一个ints()列表List< int >作为设置.但是,我无法弄清楚如何做到这一点.我搜索了文档,stackoverflow和谷歌,我找不到如何做到这一点的体面解释.

基于我发现的稀疏示例,我的预感是我必须创建一个可序列化的类来包装我的数组或List,然后我将能够在设置设计器中使用该类型.但是,我不确定如何做到这一点.

c# arrays settings winforms

90
推荐指数
3
解决办法
6万
查看次数

让CSS"浮动:向右"并垂直居中

我有一些问题,让一小段文字在图像旁边漂浮时居中.

<html>
<head>
<style type="text/css">
img 
{
float:right;
}
</style>
</head>
<body>
<p>In the paragraph below, we have added an image with style <b>float:right</b>. The result is that the image will float to the right in the paragraph.</p>
<div>
<img src="logocss.gif" width="95" height="84" />
<div style="position:relative; top: 20px;">
This 
</div>
<div>
Other stuff...
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

(您可以将此代码复制并粘贴到http://www.w3schools.com/CSS/tryit.asp?filename=trycss_float中以查看其实际效果.

我想要的是一种在浮动图像时垂直居中的方法.而且也不会弄乱它之后的文字.(正如你所看到的,"其他东西......"在"这个"之上)

我更喜欢纯CSS方法(或者可能重组div等),因为这只是一个显示问题的例子.它正在使用的应用程序非常复杂,将它全部放入表中需要相当多的工作,并且可能看起来不正确.

UPDATE

好吧,我已经删除了我的asp.net生成页面的一部分,它显示了我遇到的问题.我意识到代码是丑陋的道歉.它是由机器生成的

<html>
<head>
<style type="text/css">
img 
{
    float:right;
}
</style>
</head>
<body>
<p>In the paragraph below, we have added …
Run Code Online (Sandbox Code Playgroud)

html css css-float

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

如何处理作为HTTP Post发送到cakephp应用程序的json数据?

如果我发送一个HTTP POST在HTTP请求的主体仅仅是一个UTF8编码的字符串,我如何访问我的CakePHP控制器的数据?似乎$ this-> params只包含以下内容:

{
    "pass":[],
    "named":[],
    "controller":"users",
    "action":"checkin",
    "plugin":null,
    "url":{
        "ext":"json",
        "url":"users\/checkin.json"
    },
    "form":[],
    "isAjax":false
}
Run Code Online (Sandbox Code Playgroud)

发布的数据看起来像这样:

{
    "sessionkey":"somecrazykey",
    "longitude":"-111.12345",
    "latitude":"33.12345",
    "reqtype":"checkin",
    "location":"the mall",
    "public":"true"
}
Run Code Online (Sandbox Code Playgroud)

cakephp

6
推荐指数
2
解决办法
5986
查看次数

在线程中复制文件

我试图通过调用一个单独的线程来复制文件.这是我的表单代码:

unit frmFileCopy;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ComCtrls, StdCtrls;

type
  TForm2 = class(TForm)
    Button3: TButton;
    procedure Button3Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
  private
    ThreadNumberCounter : integer;
    procedure HandleTerminate (Sender: Tobject);

  end;

var
  Form2: TForm2;

implementation

uses
  fileThread;

{$R *.dfm}

{ TForm2 }
const
  sourcePath = 'source\'; //'
  destPath =  'dest\'; //'
  fileSource = 'bigFile.zip';
  fileDest = 'Copy_bigFile.zip';

procedure TForm2.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
  CanClose := true;
  if …
Run Code Online (Sandbox Code Playgroud)

delphi multithreading

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

jQuery选择具有特定属性的第一个子节点

我有一个HTML格式的表单,提交的类型为多个输入:

<form id = "myForm1" action="doSomethingImportant/10" class="postLink" method="post">
<input type="hidden" id="antiCSRF" name="antiCSRF" value="12345"></input>
<input type="submit" value="clickThisLink"></input>
<input type="submit" value="Don'tclickThisLink"></input>
</form>
Run Code Online (Sandbox Code Playgroud)

我想要做的是只选择第一个输入类型为submit而忽略其他输入,我目前拥有的代码片段如下,注意它在for-each循环中,遍历我页面上的所有表单,因此(这个)以避免混淆:

var name = $(this).find("input[type='submit']").val();
Run Code Online (Sandbox Code Playgroud)

我想这已经抓住类型的第一个输入默认情况下提交,我不知道如果这假设是正确的,或者如果有要去了解它,谢谢更正式的方式.

javascript xhtml jquery

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

Python,UnicodeDecodeError

我收到此错误:

UnicodeDecodeError: 'ascii' codec can't decode byte 0xe0 in position 4: ordinal not in range(128)
Run Code Online (Sandbox Code Playgroud)

我尝试设置许多不同的编解码器(在标题中# -*- coding: utf8 -*-),甚至使用u"string",但它仍然出现.

我该如何解决?

编辑:我不知道导致这个的实际字符,但由于这是一个递归浏览文件夹的程序,它必须在其名称中找到一个包含奇怪字符的文件

码:

# -*- coding: utf8 -*-


# by TerabyteST

###########################

# Explores given path recursively
# and finds file which size is bigger than the set treshold

import sys
import os

class Explore():
    def __init__(self):
        self._filelist = []

    def exploreRec(self, folder, treshold):
        print folder
        generator = os.walk(folder + "/")
        try:
            content = generator.next()
        except:
            return
        folders …
Run Code Online (Sandbox Code Playgroud)

python unicode

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

Code Golf:自来水

挑战

按字符排序的最短代码,用于从输入中识别和标记土地的ASCII表示中的水凹陷.

输入将是景观的ASCII表示,具有丘陵,山谷和平坦的土地.该程序应模拟景观如果被淹没将会是什么样子 - 用水填充所有山谷(角色x).

景观将始终以角色开始和停止,_并且至少2个字符长,输入最短__.

山被定义为加高,不应该用水填充:

  __
_/  \_
Run Code Online (Sandbox Code Playgroud)

山谷被定义为凹陷,将被水填满,直到遇到平地:

_    _
 \__/
Run Code Online (Sandbox Code Playgroud)

可以假定输入是干净的,并且仅由字符space(), newline (\n),下划线(_)以及前向和后向斜杠(/\)组成.输入可以看作是一条连续线,以及包含模糊线输入的任何输入,如_/_

_   _
 \_/
 / \
Run Code Online (Sandbox Code Playgroud)

被认为无效.

关于水下洞穴,如果洞穴水位高于水位,则应保持水位.

测试用例

Input:
    __/\__
          \__              
             \       ___       ___________
             /      /   \_     \_
             \_____/      \__  _/
                             \/
Output:

    __/\__
          \__              
             \       ___       ___________
             /xxxxxx/   \xxxxxx\_
             \xxxxx/      \xxxxx/
                             \/
Run Code Online (Sandbox Code Playgroud)
Input:
                                         __       ___
                                        /  \_____/
                                       / _______
                         ________     /  \     /
                   _____/        \ …
Run Code Online (Sandbox Code Playgroud)

language-agnostic code-golf rosetta-stone

53
推荐指数
4
解决办法
3156
查看次数

我可以强制mysql首先执行子查询吗?

我有这样的查询:

SELECT `table_1`.* from `table_1`
  INNER JOIN `table_2` [...]
  INNER JOIN `table_3` [...]
WHERE `table_1`.`id` IN(
  SELECT `id` FROM [...]
)
AND [more conditions]
Run Code Online (Sandbox Code Playgroud)

当我使用EXPLAIN时,最后会有'DEPENDENT SUBQUERY',但我希望在其他条件之前先执行此子查询.

有可能吗?

mysql sql subquery

8
推荐指数
3
解决办法
4951
查看次数

什么时候不在Java中使用static关键字?

什么时候在方法签名上使用Java中的static关键字被认为是不好的做法?如果方法基于某些参数执行函数,并且不需要访问非静态的字段,那么您是否总是希望这些类型的方法是静态的?

java static static-methods

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