asp.net - how to retain viewstate for the dynamic controls created in GRIDVIEW -


i creating dynamic textbox onrowcreated event in gridview control, when try findcontrol null

here how dong...

protected void gvorg_rowcreated(object sender, gridviewroweventargs e) {    if ((e.row.rowstate == (datacontrolrowstate.edit | datacontrolrowstate.alternate)) || (e.row.rowstate == datacontrolrowstate.edit))     {       if (e.row.rowtype == datacontrolrowtype.datarow)          {               txbox txtreg = new textbox();               txtreg.id = "_registration" + e.row.rowindex + rowid.tostring();               txtreg.text = reg.registrationtoken;               e.row.cells[7].controls.add(txtreg);          }     } }     protected void gvorg_rowupdating(object sender, gridviewupdateeventargs e)         {             .....             ....              textbox _registration1 = gvorg.rows[e.rowindex].cells[7].findcontrol("_registration" + e.rowindex + rowid) textbox;            } 

have tried find by:

gridview gv = (gridview)sender; gridviewrow gvr = (gridviewrow)gv.rows[e.rowindex]; (textbox)gvr.findcontrol("_registration" + e.row.rowindex + "_" + reg.registrationid.tostring()) 

Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -