Grid View, programmatically set gridview textbox property readonly=false

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • johnlim20088
    New Member
    • Jan 2007
    • 74

    Grid View, programmatically set gridview textbox property readonly=false

    Hi

    Someone please help me


    string typ;
    if (e.Row.RowType == DataControlRowT ype.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.
  • johnlim20088
    New Member
    • Jan 2007
    • 74

    #2
    :( Help -> Grid View, programmaticall y set gridview textbox property readonly=false

    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_onDat aBound()

    as follow

    if (e.Row.RowState == DataControlRowS tate.Edit)
    {

    TextBox msgtxtBox1 = (TextBox)e.Row. FindControl("tx tbox1");
    msgtxtBox1.Read Only = 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?

    Comment

    • gomzi
      Contributor
      • Mar 2007
      • 304

      #3
      Originally posted by johnlim20088
      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_onDat aBound()

      as follow

      if (e.Row.RowState == DataControlRowS tate.Edit)
      {

      TextBox msgtxtBox1 = (TextBox)e.Row. FindControl("tx tbox1");
      msgtxtBox1.Read Only = 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!!!

      Comment

      Working...