Forum     

Go Back   Digit Technology Discussion Forum > Software > Programming
Register FAQ Calendar Mark Forums Read

Programming The destination for developers - C, C++, Java, Python and the lot


Reply
 
LinkBack Thread Tools Display Modes
Old 16-02-2011, 09:29 AM   #1 (permalink)
Right Off the Assembly Line
 
deepakgates's Avatar
 
Join Date: May 2008
Location: Home
Posts: 36
Exclamation Textbox in gridview asp.net


So I dynamically added textbox into gridview in page load event

Dim r, c As Integer
For c = 0 To GridView.HeaderRow.Cells.Count - 1
For r = 0 To GridView.Rows.Count - 1
Dim tb As TextBox = New TextBox
tb.ID = "tb " + r.ToString + " " + c.ToString
GridView.Rows(r).Cells(c).Controls.Add(tb)
Next
Next

And in other event I just cant access those textbox ..

For c = 0 To GridView.HeaderRow.Cells.Count - 1
For r = 0 To GridView.Rows.Count - 1
Dim tbname As String = "tb " + r.ToString + " " + c.ToString
Dim tb = New TextBox
tb = GridView.Rows(r).Cells(c).FindControl(tbname)
Response.Write(tb.Text)
Next
Next

Tried almost everything
Dim tb = New TextBox
tb = GridView.Rows(r).Cells(c).FindControl(tbname)
tb = CType(GridView.Rows(r).Cells(c).FindControl(tbname ), TextBox)
IT always gives null exception

Searched again and again with no gain SO thinkdigit seemed right spot!!

Thanks!!

Last edited by deepakgates; 16-02-2011 at 09:39 AM.
deepakgates is offline   Reply With Quote
Advertisements. Register and be a member of the community to get rid of them.
Advertisement

Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


 
Latest Threads
- by Charan
- by Charan

Advertisement




All times are GMT +5.5. The time now is 03:25 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.

Search Engine Optimization by vBSEO 3.3.2