473,402 Members | 2,061 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,402 software developers and data experts.

Reference a Textbox in a dynamically created header row in a gridview

Hi

I have a gridview that onRowCreated adds a second header row above the first one. In the created one there is a textbox control. My question is how would I access that textbox in the code behind?


The code for the created row is below:

Expand|Select|Wrap|Line Numbers
  1.  
  2.             If e.Row.RowType = DataControlRowType.Header Then
  3.                 Dim gvHeaderGrid As GridView = sender
  4.                 Dim gvrHeaderGridview As New GridViewRow(0, 0, DataControlRowType.Header, DataControlRowState.Insert)
  5.                 Dim txtExpectedBlackSwanDate As New TextBox
  6.                 txtExpectedBlackSwanDate.Columns = 3
  7.                 txtExpectedBlackSwanDate.CssClass = "input"
  8.                 Dim lblExpectedBlackSwanDate As New Label
  9.                 lblExpectedBlackSwanDate.Text = "Black Swan Expected Date:"
  10.  
  11.                 For colAdd = 0 To 2
  12.                     Dim tblCellAdd As New TableCell
  13.                     If colAdd = 0 Then
  14.                         tblCellAdd.Controls.Add(lblExpectedBlackSwanDate)
  15.                         tblCellAdd.Controls.Add(txtExpectedBlackSwanDate)
  16.                     ElseIf colAdd = 1 Then
  17.                         tblCellAdd.Text = "Black Swan Cycle"
  18.                     ElseIf gvBlackSwanDeflation.AutoGenerateColumns = True And colAdd = 2 Then
  19.                         tblCellAdd.Text = "Black Swan Deflation Rates per Annum"
  20.                     End If
  21.  
  22.                     If colAdd < 1 Then
  23.                         tblCellAdd.ColumnSpan = 1
  24.                     ElseIf colAdd = 1 Then
  25.                         tblCellAdd.ColumnSpan = 2
  26.                     ElseIf gvBlackSwanDeflation.AutoGenerateColumns = True And colAdd = 2 Then
  27.                         tblCellAdd.ColumnSpan = 6
  28.                     Else
  29.                         tblCellAdd.ColumnSpan = 3
  30.                     End If
  31.                     tblCellAdd.HorizontalAlign = HorizontalAlign.Center
  32.                     gvrHeaderGridview.Cells.Add(tblCellAdd)
  33.                 Next
  34.  
  35.                 CType(gvBlackSwanDeflation.Controls(0), Table).Rows.AddAt(0, gvrHeaderGridview)
  36.  
  37.             End If
  38.         Catch ex As Exception
  39.  
  40.         End Try
  41.     End Sub
  42.  
Any help would be most appreciated. Thanks in advance
Sep 26 '11 #1
0 1375

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

Similar topics

6
by: Thomas | last post by:
Hi, I'm having a problem with the dynamically created inputfields in Internet Explorer. The situation is the following: - I have a dynamically created table with a textbox in each Cell. - It...
2
by: R Duke | last post by:
I have tried everything I can think of to change the visible property of a design time created control from a dynamically created control's command event handler. Here is the scenario. I have...
5
by: Jason MacKenzie | last post by:
I'm trying to capture the text property of a dynamically created textbox on the screen.. I can't get this simple example to work. I get "Object Reference Not set to instance....." on the...
7
by: mef526 | last post by:
I would like to reference a dynamically created control and I know the name. I would like to use the following: Dim strName as String = "txtControl1" ' This is the ".Name" used when textbox was...
1
by: tfsmag | last post by:
Hello, I have a function that returns a dynamically created gridview. This works fine, however it does not seem to be able to maintain state when adding sorting or paging to the gridview. Does...
0
by: yeltsin27 | last post by:
I need some advice on handling dynamically added controls in a GridView. My app takes an uploaded CSV file containing addresses, converts it to a DataTable, databinds the DataTable to a...
2
by: JaM | last post by:
Hi all, I have created a gridview vith dynamic textbox columns (they are in variable number, it depends on what things I select from database) aspx code:...
2
by: gnewsgroup | last post by:
I have a GridView, in which the header of one column changes depending on the selected value of a DropDownList outside of this GridView. I did this dynamic header through protected void...
1
by: semomaniz | last post by:
I have a form where i have created the form dynamically. First i manually added a panel control to the web page. Then i added another panel dynamically and inside this panel i created tables. I have...
5
by: joss Perold | last post by:
Hi I have created a gridview dynamically from scratch and added it to my aspx page. This works fine, but i have a button in the footer of on of the columns, which when clicked on makes the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.