findcontrol on textbox returns empty string
From: Rimu Atkinson (rimu1_at_paradise.net.removenospamthing.nz)
Date: 02/03/04
- Next message: Norman Yuan: "Re: Crystal report"
- Previous message: Scott M.: "Re: Bill Gate Tries to Wreck Another Linux Stock: RHAT Using Barron's"
- Next in thread: asneader: "Re: findcontrol on textbox returns empty string"
- Reply: asneader: "Re: findcontrol on textbox returns empty string"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 3 Feb 2004 16:16:37 +1300
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
- Next message: Norman Yuan: "Re: Crystal report"
- Previous message: Scott M.: "Re: Bill Gate Tries to Wreck Another Linux Stock: RHAT Using Barron's"
- Next in thread: asneader: "Re: findcontrol on textbox returns empty string"
- Reply: asneader: "Re: findcontrol on textbox returns empty string"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|