小编jos*_*ick的帖子

在GridView中编辑行时如何设置文本框的宽度?

我有一个可以编辑的GridView.我的问题是当我单击编辑时,文本框太小(File Name列).它不足以显示其内容,并且不如列的其余部分宽.

如何让文本框更宽广?


这是ASP代码:

<asp:GridView ID="FileGridView" runat="server" AllowPaging="True" OnPageIndexChanging="FileGridView_PageIndexChanging"
    CellPadding="1" CssClass="GridView"  GridLines="Horizontal"
    Width="100%" AutoGenerateColumns="false"
    AutoGenerateEditButton="true"
    OnRowCancelingEdit="GridView_RowCancelingEdit" OnRowEditing="GridView_RowEditing" OnRowUpdating="GridView_RowUpdating"
    >
    <Columns>
        <asp:BoundField DataField="Name" HeaderText="File Name" />
        <asp:BoundField DataField="Length" HeaderText="Size" ReadOnly="true" />
        <asp:BoundField DataField="LastWriteTime" HeaderText="Last Modified" ReadOnly="true" />
    </Columns>
    <RowStyle CssClass="GridViewRow" />
    <EditRowStyle ForeColor="Black" CssClass="GridViewEditRow" />
    <SelectedRowStyle Font-Bold="True" CssClass="GridViewSelectedRow" />
    <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
    <HeaderStyle CssClass="GridViewHeader" ForeColor="White" />
    <AlternatingRowStyle CssClass="GridViewAlternatingRow" />
</asp:GridView>
Run Code Online (Sandbox Code Playgroud)

这背后有C#代码来更新数据,这很好用.我希望解决方案是在ASP中,但如果解决方案需要一些C#代码,那对我来说没关系.

.net c# asp.net gridview

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

串口调用Threading.Timer.Change()会重置计时器的时钟吗?

如果我Threading.Timer.Change()连续两次调用,那么线程何时会运行?

例如:

myTimer.Change(5000, Timeout.Infinite);
// Only 2 seconds pass.
myTimer.Change(5000, Timeout.Infinite);
Run Code Online (Sandbox Code Playgroud)

在此之后,线程将在3秒或5秒内运行吗?

我希望答案是后者,每次调用都会重置计时器Change().如果没有,我需要找到解决方法.

.net c# timer

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

System.BadImageFormatException:如何修复.NET版本不匹配?

我在VS 2005中编写了一个dll,它将由另一个在VS 2003中开发的程序加载.当该程序试图加载我的dll时,它会抛出一个System.BadImageFormatException: The format of the file 'Foo.dll' is invalid.

我搜索了SO和谷歌,似乎不同版本的.NET是罪魁祸首.我的问题是:我该如何解决这个问题?

(我无法修改VS 2003中开发的程序.)

.net visual-studio-2003 visual-studio-2005 visual-studio

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

如何向类似 defn 的 Clojure 宏添加文档字符串支持?

我写了一个宏来在一些有用的日志记录中包装一个函数定义:

(defmacro defn-logged
  "Wraps functions in logging of input and output"
  [fn-name args & body]
  `(defn ~fn-name ~args
     (log/info '~fn-name "input:" ~@args)
     (let [return# (do ~@body)]
       (log/info '~fn-name "output:" return#)
       return#)))
Run Code Online (Sandbox Code Playgroud)

这对于没有文档字符串的函数非常有用:

(defn-logged foo
  [x]
  (* 2 x))

(foo 3)
; INFO - foo input: 3
; INFO - foo output: 6
; 6
Run Code Online (Sandbox Code Playgroud)

但是如果对于带有 docstrings 的函数非常失败:

(defn-logged bar
  "bar doubles its input"
  [x]
  (* 2 x))
; IllegalArgumentException Parameter declaration clojure.tools.logging/info should be a vector
Run Code Online (Sandbox Code Playgroud)

如何让我的宏适用于有和没有文档字符串的函数?

macros clojure

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