Im trying to set value of a textbox, but it fails.
txtBox.Text = obj.Effekt does nothing on the page, but the last one
does.
Fieldname is positively correct.
What am I doing wrong?
Dim listNr As String = Right(ListName, 1)
Dim FieldName As String = "txt5" & listNr & "_effekt"
Dim txtBox As New TextBox
txtBox.ID = FieldName
Dim obj As Naturgas
obj = CType(_naturgasList(idx), Naturgas)
txtBox.Text = obj.Effekt
Me.txt51_effekt.Text = obj.Effekt
/Snedker 6 1019
Hi,
Morten Snedker wrote:
Im trying to set value of a textbox, but it fails.
txtBox.Text = obj.Effekt does nothing on the page, but the last one
does.
Fieldname is positively correct.
What am I doing wrong?
Dim listNr As String = Right(ListName, 1)
Dim FieldName As String = "txt5" & listNr & "_effekt"
Dim txtBox As New TextBox
txtBox.ID = FieldName
Dim obj As Naturgas
obj = CType(_naturgasList(idx), Naturgas)
txtBox.Text = obj.Effekt
Me.txt51_effekt.Text = obj.Effekt
/Snedker
You create a brand new TextBox, but you don't add it to the Page. It's
just an object which will be deleted as soon as the Page is recycled
(when the Response is sent).
HTH,
Laurent
--
Laurent Bugnion [MVP ASP.NET]
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
You are never adding the txtBox to the page...you need a placeholder or some
other container on the page..
myPlaceholder.Controls.Add(txtBox);
Karl
-- http://www.openmymind.net/ http://www.fuelindustries.com/
"Morten Snedker" <morten_spammenot_ATdbconsult.dkwrote in message
news:c0********************************@4ax.com...
Im trying to set value of a textbox, but it fails.
txtBox.Text = obj.Effekt does nothing on the page, but the last one
does.
Fieldname is positively correct.
What am I doing wrong?
Dim listNr As String = Right(ListName, 1)
Dim FieldName As String = "txt5" & listNr & "_effekt"
Dim txtBox As New TextBox
txtBox.ID = FieldName
Dim obj As Naturgas
obj = CType(_naturgasList(idx), Naturgas)
txtBox.Text = obj.Effekt
Me.txt51_effekt.Text = obj.Effekt
/Snedker
On Tue, 23 Jan 2007 08:59:00 -0500, "Karl Seguin [MVP]"
<ka********@removeopenmymindremovemetoo.andmenetwr ote:
Thanks to the both of you. It seems I haven't explained myself
properly:
I have txt51_effekt, txt52_effekt..txt55_effekt
What I'm trying to do is to reference these dynamically, not creating
new ones. So I guess I got it all wrong. :-\
So, how do I reference each of them dynamically?
Regards /Snedker
TextBox txt = Page.FindControl(string.Format("txt{0}_effket", _someId)) as
TextBox;
if (txt == null)
{
//something bad happened
}
Karl
-- http://www.openmymind.net/ http://www.fuelindustries.com/
"Morten Snedker" <morten_spammenot_ATdbconsult.dkwrote in message
news:54********************************@4ax.com...
On Tue, 23 Jan 2007 08:59:00 -0500, "Karl Seguin [MVP]"
<ka********@removeopenmymindremovemetoo.andmenetwr ote:
Thanks to the both of you. It seems I haven't explained myself
properly:
I have txt51_effekt, txt52_effekt..txt55_effekt
What I'm trying to do is to reference these dynamically, not creating
new ones. So I guess I got it all wrong. :-\
So, how do I reference each of them dynamically?
Regards /Snedker
On Tue, 23 Jan 2007 10:12:05 -0500, "Karl Seguin [MVP]"
<ka********@removeopenmymindremovemetoo.andmenetwr ote:
Worked like a charm! Thanks a bunch to each of you for your help!
Regards /Snedker This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: 2obvious |
last post by:
I have a DataGrid containing a TextBox control and a CustomValidator
in each row.
The CustomValidator fires a function that compares all TextBoxes for
equality. The
algorithm for comparison...
|
by: 2obvious |
last post by:
I have a DataGrid containing a TextBox control and a CustomValidator
in each row. The CustomValidator fires a function that compares all
TextBoxes for equality. The algorithm for comparison is...
|
by: markh |
last post by:
Does anyone know where i could find a good website that explains many
techniques for direct control referencing?
thanks markh
|
by: cmd |
last post by:
I have code in the OnExit event of a control on a subform. The code
works properly in this instance. If, however, I put the same code in
the OnExit event of a control on a Tab Control of a main...
|
by: sansie |
last post by:
Hi,
I have a page which is basically a details view(in inset mode) inside a datalist.
The problem is I want to set the field "invoiceID" (of the detailsview) to an invoiceID coming through the...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
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
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
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...
|
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,...
|
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...
| |