473,397 Members | 1,974 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,397 software developers and data experts.

Dynamic Textbox Array

Hello,

Im trying to create a dynamic array of textboxes from an array
returned by a web service. THe web service returns a list of fields
that I need to place on a dynamically created web page. The problem I
am having is when the button event is clicked, the text typed in the
textbox doesn't get saved with the textbox. I might be way off base
with even trying this. If anyone could give me some idea on what is
going wrong or another way to produce the form, I would greatly
appreciate it.

Here is the following code for the page I am producing

Try
If Not Me.IsPostBack Then
Result = FieldList.GetFieldListing(FEID, ClientID, UserName,
Password, Fields, ErrMsg)
If Not Result Is Nothing Then
For j = 0 To UBound(Result)
txtBox = New System.Web.UI.WebControls.TextBox
txtLabels = New System.Web.UI.WebControls.Label
txtLabels.ID = Result(j) & "lbl"
txtBox.ID = j
txtLabels.Enabled = True
txtLabels.EnableViewState = True
txtLabels.Font.Size = txtLabels.Font.Size.XSmall

txtLabels.Style("Position") = "Absolute"
txtLabels.Style("Top") = CStr(4 + k) & "px"
txtLabels.Style("Left") = "0px"
txtLabels.Style("Width") = "50px"
txtLabels.Text = Result(j)
txtBox.Attributes("AutoPostBack") = "True"
'txtBoxes(j).AutoPostBack = True
txtBox.Text = txtBox.ID.ToString
txtBox.ReadOnly = False
txtBox.Enabled = True
txtBox.TextMode = TextBoxMode.SingleLine
txtBox.EnableViewState = True
txtBox.Wrap = True
txtBox.Style("BorderStyle") = "NotSet"
txtBox.Style("Position") = "Absolute"
txtBox.Style("Top") = CStr(k) & "px"
txtBox.Style("Left") = "140px"
txtBox.Style("Width") = "200px"
k = k + 25
PlaceHolder1.Controls.Add(txtBox)
PlaceHolder1.Controls.Add(txtLabels)
Panel1.Controls.Add(txtBox)
Panel1.Controls.Add(txtLabels)
Panel1.Style("Height") = CStr(k) & "px"
Panel1.Style("Width") = "341px"
Panel1.Style("Top") = "5px"
Panel1.Style("Left") = "5px"
btnSearch.Style("Top") = CStr(k + 25) & "px"
btnSearch.Style("Left") = "5px"
'WebForm.Controls.Add(txtBoxes(j))
Next j
k = 0
End If
End If
Catch ErrorMessage As Exception
TextBox1.Text = ErrorMessage.Message() & ErrorMessage.Source
Finally
End Try
Nov 20 '05 #1
2 3584
Cor
Hi Eric,

Why not first trying with one very simple textbox without any condition and
then build it up in the complete style you are busy with?

I think with what you doing now is getting every time more way off base.

As a first idea of my, you need of course somewhere to have a postback
situation also or in a button event, a setted click event or in your
loadpage in the IsPostback situation..

Just a thought

Cor

Im trying to create a dynamic array of textboxes from an array
returned by a web service. THe web service returns a list of fields
that I need to place on a dynamically created web page. The problem I
am having is when the button event is clicked, the text typed in the
textbox doesn't get saved with the textbox. I might be way off base
with even trying this. If anyone could give me some idea on what is
going wrong or another way to produce the form, I would greatly
appreciate it.

Here is the following code for the page I am producing

Try
If Not Me.IsPostBack Then
Result = FieldList.GetFieldListing(FEID, ClientID, UserName,
Password, Fields, ErrMsg)
If Not Result Is Nothing Then
For j = 0 To UBound(Result)
txtBox = New System.Web.UI.WebControls.TextBox
txtLabels = New System.Web.UI.WebControls.Label
txtLabels.ID = Result(j) & "lbl"
txtBox.ID = j
txtLabels.Enabled = True
txtLabels.EnableViewState = True
txtLabels.Font.Size = txtLabels.Font.Size.XSmall

txtLabels.Style("Position") = "Absolute"
txtLabels.Style("Top") = CStr(4 + k) & "px"
txtLabels.Style("Left") = "0px"
txtLabels.Style("Width") = "50px"
txtLabels.Text = Result(j)
txtBox.Attributes("AutoPostBack") = "True"
'txtBoxes(j).AutoPostBack = True
txtBox.Text = txtBox.ID.ToString
txtBox.ReadOnly = False
txtBox.Enabled = True
txtBox.TextMode = TextBoxMode.SingleLine
txtBox.EnableViewState = True
txtBox.Wrap = True
txtBox.Style("BorderStyle") = "NotSet"
txtBox.Style("Position") = "Absolute"
txtBox.Style("Top") = CStr(k) & "px"
txtBox.Style("Left") = "140px"
txtBox.Style("Width") = "200px"
k = k + 25
PlaceHolder1.Controls.Add(txtBox)
PlaceHolder1.Controls.Add(txtLabels)
Panel1.Controls.Add(txtBox)
Panel1.Controls.Add(txtLabels)
Panel1.Style("Height") = CStr(k) & "px"
Panel1.Style("Width") = "341px"
Panel1.Style("Top") = "5px"
Panel1.Style("Left") = "5px"
btnSearch.Style("Top") = CStr(k + 25) & "px"
btnSearch.Style("Left") = "5px"
'WebForm.Controls.Add(txtBoxes(j))
Next j
k = 0
End If
End If
Catch ErrorMessage As Exception
TextBox1.Text = ErrorMessage.Message() & ErrorMessage.Source
Finally
End Try

Nov 20 '05 #2
Cor
Hi Eric,

Why not first trying with one very simple textbox without any condition and
then build it up in the complete style you are busy with?

I think with what you doing now is getting every time more way off base.

As a first idea of my, you need of course somewhere to have a postback
situation also or in a button event, a setted click event or in your
loadpage in the IsPostback situation..

Just a thought

Cor

Im trying to create a dynamic array of textboxes from an array
returned by a web service. THe web service returns a list of fields
that I need to place on a dynamically created web page. The problem I
am having is when the button event is clicked, the text typed in the
textbox doesn't get saved with the textbox. I might be way off base
with even trying this. If anyone could give me some idea on what is
going wrong or another way to produce the form, I would greatly
appreciate it.

Here is the following code for the page I am producing

Try
If Not Me.IsPostBack Then
Result = FieldList.GetFieldListing(FEID, ClientID, UserName,
Password, Fields, ErrMsg)
If Not Result Is Nothing Then
For j = 0 To UBound(Result)
txtBox = New System.Web.UI.WebControls.TextBox
txtLabels = New System.Web.UI.WebControls.Label
txtLabels.ID = Result(j) & "lbl"
txtBox.ID = j
txtLabels.Enabled = True
txtLabels.EnableViewState = True
txtLabels.Font.Size = txtLabels.Font.Size.XSmall

txtLabels.Style("Position") = "Absolute"
txtLabels.Style("Top") = CStr(4 + k) & "px"
txtLabels.Style("Left") = "0px"
txtLabels.Style("Width") = "50px"
txtLabels.Text = Result(j)
txtBox.Attributes("AutoPostBack") = "True"
'txtBoxes(j).AutoPostBack = True
txtBox.Text = txtBox.ID.ToString
txtBox.ReadOnly = False
txtBox.Enabled = True
txtBox.TextMode = TextBoxMode.SingleLine
txtBox.EnableViewState = True
txtBox.Wrap = True
txtBox.Style("BorderStyle") = "NotSet"
txtBox.Style("Position") = "Absolute"
txtBox.Style("Top") = CStr(k) & "px"
txtBox.Style("Left") = "140px"
txtBox.Style("Width") = "200px"
k = k + 25
PlaceHolder1.Controls.Add(txtBox)
PlaceHolder1.Controls.Add(txtLabels)
Panel1.Controls.Add(txtBox)
Panel1.Controls.Add(txtLabels)
Panel1.Style("Height") = CStr(k) & "px"
Panel1.Style("Width") = "341px"
Panel1.Style("Top") = "5px"
Panel1.Style("Left") = "5px"
btnSearch.Style("Top") = CStr(k + 25) & "px"
btnSearch.Style("Left") = "5px"
'WebForm.Controls.Add(txtBoxes(j))
Next j
k = 0
End If
End If
Catch ErrorMessage As Exception
TextBox1.Text = ErrorMessage.Message() & ErrorMessage.Source
Finally
End Try

Nov 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: charliewest | last post by:
I need to create textboxes in real-time, the actual number of which is determine by a result from a database query. I have been able to create the controls, and then add them to the ASPX page....
4
by: Bhavin | last post by:
How can I capture user entered values from dynamically created controls in ASP.NET ? Thanks,
1
by: Sunil Sabir | last post by:
Dear All, Actually I am want to make a function which will take a list of ID numbers retrieved from the database and diplayed their details on the web page.On the Web Page I have a textbox and...
7
by: Abraham Luna | last post by:
how do i stop the dynamic validators from breaking explorer if i use a dynamic validator and move to a different control it breaks explorer and i can type in the page when i'm not supposed to....
0
by: Eric Diana | last post by:
Hello, Im trying to create a dynamic array of textboxes from an array returned by a web service. THe web service returns a list of fields that I need to place on a dynamically created web page....
4
Frinavale
by: Frinavale | last post by:
Introduction Sometimes, when developing web applications, we need to be able to dynamically load controls based on user selections. The following article describes a simple scenario where TextBox...
1
by: MaryamSh | last post by:
Hi, I am creating a Dynamic Search in my application. I create a user control and in Page_load event I create a dynamic dropdownlist and 2 dynamic button (Add,Remove) By pressing Add button...
0
by: MaryamSh | last post by:
Create Dynamic Dropdownlist Controls and related event -------------------------------------------------------------------------------- Hi, I am creating a Dynamic Search in my application. I...
2
by: englishman69 | last post by:
Hello, I have been banging my head against this one for a while... Searches online have revealed many different proposals for correcting my issue but none that I can follow! My basic situation...
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
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:
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
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.