473,396 Members | 2,147 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

how to get values from dynamic text box in grid view

Hi,

i have created one dynamic gridview with template fields. i have a problem with retriving data from the text box. how can i find the text box control.

i am using the following code.


creating template field:
----------------------------------
Expand|Select|Wrap|Line Numbers
  1. Dim bfield As New BoundField
  2.         bfield.DataField = "Customer"
  3.         bfield.HeaderText = "Customer"
  4.         gvwCustomer.Columns.Add(bfield)
  5.         For intj = 0 To ds.Tables("GroupDet").Rows.Count - 1
  6.             Dim tf = New TemplateField()
  7.             tf.ItemTemplate = Page.LoadTemplate("../Maintenance/temp.ascx")
  8.  
  9. Retriving:
  10.  
  11. or inti = 1 To gvwCustomer.Rows.Count - 1
  12.             If gvwCustomer.Rows(inti).RowType = DataControlRowType.DataRow Then
  13.  
  14.                 Dim tc As TableCell = gvwCustomer.Rows(inti).Cells(1)
  15.                 Dim wuc As Web.UI.WebControls.TextBox = CType(tc.Controls(0), Web.UI.WebControls.TextBox)
  16.                 If Not wuc Is Nothing Then
  17.                     Dim TextBox1 As TextBox = wuc.FindControl("TextBox1")
  18.                 End If
  19.  
  20.             End If
  21.  
  22.  
  23.         Next

Where i made the mistake?


Please anyone help me?

thanks in advance

gvwCustomer.Columns.Add(tf)
Next
Oct 23 '09 #1
2 2661
tlhintoq
3,525 Expert 2GB
TIP: When you are writing your question, there is a button on the tool bar that wraps the [code] tags around your copy/pasted code. It helps a bunch. Its the button with a '#' on it. More on tags. They're cool. Check'em out.
Oct 23 '09 #2
tlhintoq
3,525 Expert 2GB
how can i find the text box control.
Why do you have to *find* it at all.
You made it right? You either put it on the form in designer so you know it's reference name, or you created it programatically so again you should have a reference to it.
Oct 23 '09 #3

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

Similar topics

8
by: Ashish Shridharan | last post by:
Hi All I have been trying to add a control to the header cell of a datagrid on my ASP.NET page. These controls are defined in the HTML as ASP.NET web controls. They are being added into the...
1
by: dschectman | last post by:
I have an interesting issue. I need to implement a dynamic table to mimic a select list. Each time you double click from the master list, a row is added to the list of selected items. The list...
0
by: SteveC | last post by:
In my ASP.NEt codebehind, I declare a public var for a DataGrid. Then in the TextChanged event handler for a TextBox, I create a <div> tag, stuff it inside the form, then instance a DataGrid and...
0
by: Colin Ramsay | last post by:
Hi all, I don't normally post swathes of code like this but I am truly banging my head off my desk here... I've dynamically created a datagrid within a usercontrol. There are two columns...
13
by: Chris Thunell | last post by:
I have created several grids dynamically and have added them to different HTML placeholders on a vb.net web form. The grids and controls within them come up and view beautifully when the web page...
4
by: Todd Perkins | last post by:
Hello all, surprisingly enough, this is my first newsgroup post, I usually rely on google. So I hope I have enough info contained. Thank you in advance for any help! Problem: I am getting...
4
by: Larry Grady | last post by:
Anyone up for a challenge? I've been struggling with this for a few days and was hoping someone could help me. Pouring through all the messageboards I just can't find the solution. We have a...
1
by: Gregory Gadow | last post by:
My latest problem: I am converting an ASP script that dynamically generated a table with radio buttons, presented the table to a web user, then processed which of the items that the user selected....
1
by: abhi83 | last post by:
Hi , I have a problem hope someone can help. I have created a dynamic view which contains a gridview. This gridview contains a check box column in the Template Field with the help of ITemplate...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.