469,271 Members | 997 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,271 developers. It's quick & easy.

Grid View, programmatically set gridview textbox property readonly=false

Hi

Someone please help me


string typ;
if (e.Row.RowType == DataControlRowType.DataRow)
{
typ = e.Row.Cells[4].Text;




I got this line in onRowDataBound


I have a problem, WHEN I SET THIS boundfield -> column 4, as Visible =true (to display in gridview), i can get th value by above code line.

If i set visible =false (which I don't want display in gridview), i cant get the value.
May 5 '07 #1
2 10743
Hi,


Currently i have a GridView with 1 text box template column, on start, i will set this textbox readonly =true

When user click edit button, i would like to set the textbox control readonly=false so user can type in new text,

i put it in gridview1_onDataBound()

as follow

if (e.Row.RowState == DataControlRowState.Edit)
{

TextBox msgtxtBox1 = (TextBox)e.Row.FindControl("txtbox1");
msgtxtBox1.ReadOnly = false;
}


well, it is work,

when i click edit in first row of the grid, the textbox readonly set to false, i can type in new text.

BUT it is very weird, because ONLY ODD NUMBER grid row can work,

when i click on second row edit button, the textbox readonly still true,

when i click on third, it is work, then when i click on 5th row, it work too..


someone can help?
May 6 '07 #2
gomzi
304 100+
Hi,


Currently i have a GridView with 1 text box template column, on start, i will set this textbox readonly =true

When user click edit button, i would like to set the textbox control readonly=false so user can type in new text,

i put it in gridview1_onDataBound()

as follow

if (e.Row.RowState == DataControlRowState.Edit)
{

TextBox msgtxtBox1 = (TextBox)e.Row.FindControl("txtbox1");
msgtxtBox1.ReadOnly = false;
}


well, it is work,

when i click edit in first row of the grid, the textbox readonly set to false, i can type in new text.

BUT it is very weird, because ONLY ODD NUMBER grid row can work,

when i click on second row edit button, the textbox readonly still true,

when i click on third, it is work, then when i click on 5th row, it work too..


someone can help?
try peforming the operations in rowcommand of the gridview.
not sure as to why odd number ones work!!!
May 6 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

reply views Thread by weiwei | last post: by
reply views Thread by Gian Paolo | last post: by
2 posts views Thread by Wayne Deleer | last post: by
3 posts views Thread by Andrew Robinson | last post: by
12 posts views Thread by brwalias | last post: by
1 post views Thread by =?Utf-8?B?Ym9iYnk=?= | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.