Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 16th, 2003, 01:44 PM
Registered User
 
Join Date: Sep 2003
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Datagrid problem

Hi

Can anyone help, on my web page I have a datagrid, I have added

<asp:TemplateColumn HeaderText="Qty">
<ItemTemplate>
<asp:TextBox id="TextBox1" runat="server" Text="" Columns="4" MaxLength="3" width="40px">
</asp:TextBox>
</ItemTemplate>
</asp:TemplateColumn>

to get an extra column, this works ok and you can enter in values

The code is

Private Sub MyList_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs ) Handles MyList.ItemCommand

 Dim l As TextBox
 Dim str As String

 l = CType(e.Item.FindControl("TextBox1"), TextBox)

 If Not (l Is Nothing) Then

   str = l.Text

 End If

End Sub

The FindControl works ok, but there is no text, the value of str, l.text are empty

doing

? e.Item.FindControl("TextBox1").id

will give

"TextBox1"

which i assume means that it has found the right control

doing

? e.Item.FindControl("TextBox1").Text

gives

'Text' is not a member of 'Control'.

there are no other controls on the form other than the datagrid

why should Textbox1 have no text member

any help greatly appreciated

Thanks




Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with datagrid Shishir ASP.NET 1.0 and 1.1 Professional 1 January 6th, 2007 09:01 AM
Datagrid Problem monika.vasvani ASP.NET 1.0 and 1.1 Professional 1 December 5th, 2006 03:09 AM
DataGrid Problem anujrathi VB.NET 2002/2003 Basics 2 June 15th, 2006 02:18 AM
DataGrid Problem anujrathi ASP.NET 2.0 Basics 1 June 12th, 2006 03:52 PM
Datagrid problem dotnetprogrammer VS.NET 2002/2003 1 February 17th, 2005 05:11 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.