hi all
i use FindControl to get a textbox, and i get a textbox object, but it's
..Text property is empty.
some background info: i have a DataList, which has a template column in it,
and in that template column i define a textbox.
<asp:TemplateColumn HeaderText="Quantity">
<ItemTemplate>
<asp:TextBox id="Quantity" runat="server" Columns="4" MaxLength="3"
Text='<%# DataBinder.Eval(Container.DataItem, "Quantity") %>' width="40px"
/>
</ItemTemplate>
</asp:TemplateColumn>
Later on, i want to go through all the rows in the datalist (called MyList),
and do some processing based on the contents of the textboxes, which may
have been changed by the user.
For i = 0 To MyList.Items.Count - 1
Dim quantityTxt As TextBox = CType(MyList.Items(i).FindControl("Quantity"),
TextBox)
'do some stuff here
Next
quantityTxt.Text is always vbNullstring. i have tried
MyList.Items(i).Cells(2).FindControl("Quantity") as well, which makes no
difference.
any idea why??
any help very much appreciated.
thanks
Rimu 1 2509
I had a similar problem when creating controls dynmically on a page.
Make sure that the call that creates the datalist is not in a "If Not
IsPostBack Then" statement. The "dynamic" controls have to be
recreated when the page is submitted to get values from them. I hope
this helps.
"Rimu Atkinson" <ri***@paradise.net.removenospamthing.nz> wrote in message news:<Us********************@news02.tsnz.net>... hi all
i use FindControl to get a textbox, and i get a textbox object, but it's .Text property is empty.
some background info: i have a DataList, which has a template column in it, and in that template column i define a textbox.
<asp:TemplateColumn HeaderText="Quantity"> <ItemTemplate> <asp:TextBox id="Quantity" runat="server" Columns="4" MaxLength="3" Text='<%# DataBinder.Eval(Container.DataItem, "Quantity") %>' width="40px" /> </ItemTemplate> </asp:TemplateColumn>
Later on, i want to go through all the rows in the datalist (called MyList), and do some processing based on the contents of the textboxes, which may have been changed by the user.
For i = 0 To MyList.Items.Count - 1
Dim quantityTxt As TextBox = CType(MyList.Items(i).FindControl("Quantity"), TextBox)
'do some stuff here
Next
quantityTxt.Text is always vbNullstring. i have tried MyList.Items(i).Cells(2).FindControl("Quantity") as well, which makes no difference.
any idea why??
any help very much appreciated.
thanks
Rimu This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Rimu Atkinson |
last post by:
hi all
i use FindControl to get a textbox, and i get a textbox object, but it's
..Text property is empty.
some background info: i have a DataList, which has a template column in it,
and in...
|
by: James G. Beldock |
last post by:
I have seen the following behavior: when issuing a Page.FindControl() for a
control which exists in an item template (from within an ItemDataBound()
event, for example), I get nulls back...
|
by: Mike Speak |
last post by:
On my page_load, I am populating a Datagrid through the normal manner
(which works) before attempting to pick out the items in one column to
use in another part of my page. This is all within...
|
by: Harry F. Harrison |
last post by:
Here's the situation...Context - Using an Inherited WebControl object as a
base for server custom controls.
In a web custom control, whenever I create a child control and add it to the
Controls...
|
by: Rimu Atkinson |
last post by:
hi all
i use FindControl to get a textbox, and i get a textbox object, but it's
..Text property is empty.
some background info: i have a DataList, which has a template column in it,
and in...
|
by: MattB |
last post by:
This is just a rephrased version of a question I posted earlier. I think I'm
closer now, so it seemed worthy of a new (more specific) post.
In my repeater I'm dynamically creating text boxes, so...
|
by: D Sheldon |
last post by:
I have created a method that accepts a string value (representing the name of a textbox) and then returns the value. Because the name of the textbox can change, I first build a string with the...
|
by: Joe |
last post by:
Hi,
Tried using the FindControl() but no luck in finidng this damn textbox
having id txtFirstName. Can someone help me with this method?
This is what I have been doing but it doesn't work,
...
|
by: Jaime |
last post by:
Hi all,
I'm going crazy trying to sort out the correct way to find a contol, here's
the scenario:
I have a web form WebForm1 that contains a user control 'UC1'... now the UC1
has another user...
|
by: =?Utf-8?B?TWlrZSBDb2xsaW5z?= |
last post by:
I am trying to get the text of an item in a GridView, but am doing something
wrong. Can someone help me with the correct C# statement I need? Below is my
GridView and my attempt to get the control....
|
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...
|
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: 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...
|
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...
|
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: 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: 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...
| |