Click here to Skip to main content
15,886,720 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionDropDownList Creation Pin
kontax28-Mar-08 8:08
kontax28-Mar-08 8:08 
GeneralRe: DropDownList Creation Pin
Mark J. Miller28-Mar-08 9:25
Mark J. Miller28-Mar-08 9:25 
GeneralRe: DropDownList Creation Pin
kontax28-Mar-08 10:04
kontax28-Mar-08 10:04 
GeneralRe: DropDownList Creation Pin
Mark J. Miller31-Mar-08 6:26
Mark J. Miller31-Mar-08 6:26 
QuestionHow to read Texbox value in a grid Pin
lav naphade28-Mar-08 8:05
lav naphade28-Mar-08 8:05 
GeneralRe: How to read Texbox value in a grid Pin
Mark J. Miller28-Mar-08 9:39
Mark J. Miller28-Mar-08 9:39 
GeneralRe: How to read Texbox value in a grid Pin
lav naphade29-Mar-08 6:01
lav naphade29-Mar-08 6:01 
GeneralRe: How to read Texbox value in a grid Pin
Mark J. Miller31-Mar-08 6:13
Mark J. Miller31-Mar-08 6:13 
To add the control you should be using the RowDataBound event (http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.rowdatabound.aspx[^]) like this:

<br />
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e){<br />
  if(e.Row.RowType == RowType.DataRow){<br />
    txt = new TextBox();<br />
    strID = "textBox1";<br />
    txt.ID=strID; <br />
<br />
    e.Row.Cells(1).Controls.Add(txt)<br />
  }<br />
}<br />


Try recursively searching the result of : GridView1.Rows[i].Cells[j]. Instead of calling
GridView1.Rows[i].Cells[j].FindControl(strTextId). Do a recursive search of each of the child controls like this:

<br />
Control ctrl = GridView1.Rows[i].Cells[j];<br />
<br />
TextBox txt = FindControlRecursive(ctrl, strTextId) as TextBox;<br />
if(txt != null){<br />
  //read the value of the text box<br />
}<br />


Where your recursive function looks like this:

<br />
private Control FindControlRecursive(Control current, String textId){<br />
  Control result = current.FindControl(textId);<br />
  if(result != null)<br />
    return result;<br />
<br />
  foreach(Control ctrl in current.Controls){<br />
    result = FindControlRecursive(ctrl, textId)<br />
    if(result != null)<br />
      return result;<br />
  }<br />
<br />
  return null;<br />
}<br />



QuestionGridview with nested repeater width problem Pin
allenpotter28-Mar-08 6:18
allenpotter28-Mar-08 6:18 
GeneralExtending login webcontrol Pin
Rey999928-Mar-08 6:04
Rey999928-Mar-08 6:04 
GeneralRe: Extending login webcontrol Pin
Not Active28-Mar-08 7:07
mentorNot Active28-Mar-08 7:07 
GeneralRe: Extending login webcontrol Pin
Rey999930-Mar-08 0:32
Rey999930-Mar-08 0:32 
GeneralRe: Extending login webcontrol Pin
Rey999930-Mar-08 21:20
Rey999930-Mar-08 21:20 
Generalsimple project Pin
laziale28-Mar-08 5:27
laziale28-Mar-08 5:27 
GeneralRe: simple project Pin
eyeseetee28-Mar-08 5:41
eyeseetee28-Mar-08 5:41 
GeneralRe: simple project Pin
J4amieC28-Mar-08 6:30
J4amieC28-Mar-08 6:30 
GeneralWebResource.axd gives SSL error warning - how do I turn it off? [modified] Pin
ERG Web Dev28-Mar-08 5:20
ERG Web Dev28-Mar-08 5:20 
QuestionMedium Trust webserver won't let me use a Forms Authentication Provider [modified] Pin
bambi_nl28-Mar-08 5:15
bambi_nl28-Mar-08 5:15 
GeneralASP.Net, Multithreading, and Response object Pin
Vodstok28-Mar-08 5:15
Vodstok28-Mar-08 5:15 
GeneralRe: ASP.Net, Multithreading, and Response object [modified] Pin
nelo_28-Mar-08 5:51
nelo_28-Mar-08 5:51 
GeneralCall webservice method with messgedigest Pin
mpavas28-Mar-08 5:05
mpavas28-Mar-08 5:05 
Generalasp.net is not redirecting a page to proper login.aspx page for authentication. Pin
coolsatty28-Mar-08 5:01
coolsatty28-Mar-08 5:01 
GeneralRe: asp.net is not redirecting a page to proper login.aspx page for authentication. Pin
eyeseetee28-Mar-08 5:09
eyeseetee28-Mar-08 5:09 
GeneralRe: asp.net is not redirecting a page to proper login.aspx page for authentication. Pin
coolsatty29-Mar-08 5:15
coolsatty29-Mar-08 5:15 
GeneralRe: asp.net is not redirecting a page to proper login.aspx page for authentication. Pin
Jesse Squire28-Mar-08 5:11
Jesse Squire28-Mar-08 5:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.