GridView中動態(tài)設(shè)置CommandField是否可用或可見的小例子
更新時間:2013年05月08日 11:07:43 作者:
GridView中動態(tài)設(shè)置CommandField是否可用或可見的小例子,需要的朋友可以參考一下
復(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 == " ")
{
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對象講解
相關(guān)文章
ASP.NET MVC中SignalR的簡單應(yīng)用
這篇文章主要為大家詳細介紹了ASP.NET MVC中SignalR的簡單應(yīng)用,具有一定的參考價值,感興趣的小伙伴們可以參考一下2017-07-07
win7-vs2012下安裝.net frame work 的過程圖文詳解
這篇文章主要介紹了win7-vs2012下安裝.net frame work 的過程圖文詳解,非常不錯,具有一定的參考借鑒價值,需要的朋友可以參考下2019-05-05
asp.net音頻轉(zhuǎn)換之.amr轉(zhuǎn).mp3(利用七牛轉(zhuǎn)換法)
相信很多人都遇到amr格式的音頻文件不能直接在網(wǎng)頁播放的問題,有人使用QuickTime插件的輔助,下面這篇文章主要給大家介紹了asp.net音頻轉(zhuǎn)換之利用七牛轉(zhuǎn)換法將.amr格式轉(zhuǎn).mp3格式,需要的朋友可以參考借鑒,下面來一起看看吧。2016-12-12
Ext.net中的MessageBox的簡單應(yīng)用實現(xiàn)代碼
今天在項目中要用到簡單的MessageBox的使用。在Ext.net中沒有Winform那么簡單,直接寫MessageBox.show()的方法。于是就去examples.ext.net的例子網(wǎng)站找,想找到個實際能用的2012-03-03
WPF使用代碼創(chuàng)建數(shù)據(jù)模板DataTemplate
本文詳細講解了WPF使用代碼創(chuàng)建數(shù)據(jù)模板DataTemplate的方法,文中通過示例代碼介紹的非常詳細。對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下2022-02-02

