0
我想要READONLY使用Boundsfield的文本框。到目前爲止,啓用了工作,但在rowupdating如何在編輯模式下使用BoundField在GridView文本框中應用「Readonly」
protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
{
var nopoject = ddlproject.SelectedValue.ToString();
Int32 curntMonth = Convert.ToInt32(DateTime.Now.ToString("MM"));
int Mont1 = curntMonth - 1;
var Comtext = "Rst" + Mont1.ToString();
GridView1.EditIndex = e.NewEditIndex;
BindData();
foreach (GridViewRow row in GridView1.Rows)
{
for (int i = 0; i < GridView1.Columns.Count; i++)
{
String headertext = GridView1.Columns[i].HeaderText;
String cellText = row.Cells[i].Text;
if (Comtext == "Rst1")
{
GridView1.Rows[e.NewEditIndex].Cells[i].Enabled = true;
}}}
下面的代碼不工作也沒有攜帶價值:
GridView1.Rows[e.NewEditIndex].Cells[i].Attributes.Add("readonly", "readonly");
GridView1.Rows[e.NewEditIndex].Cells[i].CssClass = "read-only";
請指教。我想上boundsfield只讀 programically當聯編輯 謝謝
我只想在RowEditing時獲得成功。 – user3538475
@ user3538475 - 請檢查更新的代碼 – jignesh
對不起,對於遲到的答覆... .FindControl(「TextBox1」)=如何查找循環? – user3538475