ASP.Net 备忘录

  • 强制转换: Convert
  • 获得系统时间:DateTime
  • 数据库返回为空的值: DBNull.Value
  • 关于DropDownList.Text 无法赋值:赋值的话,Text所指的值必须存在。Text 为 DropDownList.DataValueField 的值(从现在看来)
  • DropDownList必须在设置属性AutoPostBack为True时,Event里的SelectedIndexChanged才回被调用
  • StreamWriter:在实例化的时候,参数 append 为 false 会覆盖写入的文件;为true,反之。
  • using Excel = Microsoft.Office.Interop.Excel;
  • FileStream,StreamWirter,BinaryWriter在写文本的一些差异:
  1. FileStream 在输入二进制流进文本时,会在最后面(自己的输入结束后)自动添加一些换行符(X0A)或制表符(X09),得到一些不想要的结果
  2. StreamWriter 用来写文本的话,会有三字节的文件头
  3. BinaryWriter  写入文本时,所见即所得
    • 下面这句是实现在 gridView 里嵌套的 DropDownList 内绑定数据,这样就不用一个一个的DropDownList 去赋值了
    • <asp:GridView ID="gridView" runat="server" AutoGenerateColumns="False"
                  AllowPaging="True" AllowSorting="True"
                  onrowediting="gridViewl_RowEditing" >
                  <Columns>
                      <asp:TemplateField HeaderText="位置">
                          <ItemTemplate>
                              <asp:DropDownList ID="dropDonwListCasterPosition" runat="server"       DataSource="<%# DataBind()%>"
                                  DataValueField="ID" DataTextField="Description">
                              </asp:DropDownList>
                          </ItemTemplate>
                      </asp:TemplateField>
                  </Columns>
              </asp:GridView>
    • 在网页弹出信息: ClientScript.RegisterStartupScript(typeof(string), "js", "alert('行索引:" + row.RowIndex + "');", true);

     

     

    • 0
      点赞
    • 1
      收藏
      觉得还不错? 一键收藏
    • 0
      评论
    评论
    添加红包

    请填写红包祝福语或标题

    红包个数最小为10个

    红包金额最低5元

    当前余额3.43前往充值 >
    需支付:10.00
    成就一亿技术人!
    领取后你会自动成为博主和红包主的粉丝 规则
    hope_wisdom
    发出的红包
    实付
    使用余额支付
    点击重新获取
    扫码支付
    钱包余额 0

    抵扣说明:

    1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
    2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

    余额充值