主頁 > 知識庫 > GridView中動態(tài)設(shè)置CommandField是否可用或可見的小例子

GridView中動態(tài)設(shè)置CommandField是否可用或可見的小例子

熱門標(biāo)簽:阿里云 Linux服務(wù)器 服務(wù)器配置 銀行業(yè)務(wù) Mysql連接數(shù)設(shè)置 團購網(wǎng)站 電子圍欄 科大訊飛語音識別系統(tǒng)
復(fù)制代碼 代碼如下:

 protected void gvMaterial_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow || e.Row.RowType == DataControlRowType.Header)
            {
                e.Row.Cells[0].Visible = false;

            }
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                e.Row.Cells[1].Text = (gvMaterial.PageIndex * gvMaterial.PageSize + e.Row.RowIndex + 1).ToString();
                string price;
                try //讓編輯功能在特定條件下可以用
                {
                     price = ((TextBox)e.Row.Cells[4].Controls[0]).Text;//點編輯的時候用
                }
                catch
                {
                     price = e.Row.Cells[4].Text;    //出始時用
                }                         
                if (price == "" || price == "nbsp;")
                {
                    e.Row.Cells[7].Controls[0].Visible = false;
                }
                else
                {
                    e.Row.Cells[7].Controls[0].Visible = true;
                }
            }
        }
 
您可能感興趣的文章:
  • 用Command對象和RecordSet對象向數(shù)據(jù)庫增加記錄哪一個更好
  • 使用Jmail及Winwebmail發(fā)信時系統(tǒng)記錄中的錯誤:502 Error: command ...
  • Delphi Command模式
  • asp中command的在單條記錄時,有些字段顯示為空的問題
  • javascript document.execCommand() 常用解析
  • asp.net gridview的Rowcommand命令中獲取行索引的方法總結(jié)
  • php設(shè)計模式 Command(命令模式)
  • php設(shè)計模式 Command(命令模式)
  • 獲取Repeter的Item和ItemIndex/CommandArgument實現(xiàn)思路與代碼
  • 解決VS2012 Express的There was a problem sending the command to the program問題
  • bash scp command not found的解決方法
  • document.execCommand()的用法小結(jié)
  • pip 錯誤unused-command-line-argument-hard-error-in-future解決辦法
  • 在RowCommand事件中獲取索引值示例代碼
  • ON_COMMAND_RANGE多個按鈕響應(yīng)一個函數(shù)的解決方法
  • C#命令模式(Command Pattern)實例教程
  • ASP基礎(chǔ)知識Command對象講解

標(biāo)簽:衡水 衢州 萍鄉(xiāng) 蚌埠 江蘇 棗莊 廣元 大理

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《GridView中動態(tài)設(shè)置CommandField是否可用或可見的小例子》,本文關(guān)鍵詞  ;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 收縮
    • 微信客服
    • 微信二維碼
    • 電話咨詢

    • 400-1100-266