Urgent!Pls help me with getting data from the textbox template field in the gridview?


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Urgent!Pls help me with getting data from the textbox template field in the gridview?

Hybrid View

  1. #1
    Join Date
    Feb 2007
    Posts
    6

    Urgent!Pls help me with getting data from the textbox template field in the gridview?

    Can anyone help me with getting data from the textbox template field in the gridview?

    Here is my code for the textbox template field in the gridview.

    <Columns>
    <asp:TemplateField HeaderText="Quantity">
    <ItemTemplate>
    <asp:textbox runat="server" ID="QuantityTxtBox" />
    </ItemTemplate>
    </asp:TemplateField>
    </Columns>

    After entering data into the textbox in the gridview, I try to get the data in the first row and display it into LABEL1 with the following code

    Dim text As String
    Dim tb As TextBox = CType(LecReqGV.Rows(0).FindControl("QuantityTextbox"), TextBox)

    If Not (tb.Text.Equals("")) Then
    text = tb.Text
    Label1.Text = text
    End If


    The code doesn’t work and the error message “Object reference not set to an instance of an object.” keeps prompting out. Can anyone help me with that?

  2. #2
    Join Date
    Feb 2007
    Posts
    2
    probably because

    QuantityTxtBox is spelt differently to QuantityTextbox

Similar Threads

  1. Replies: 0
    Last Post: 03-02-2006, 04:29 PM
  2. Replies: 0
    Last Post: 02-15-2006, 09:14 AM
  3. Bound Textbox Field Order
    By Bob in forum VB Classic
    Replies: 0
    Last Post: 06-27-2001, 01:15 PM
  4. Replies: 0
    Last Post: 11-02-2000, 09:54 AM
  5. search for SQL 'date' field not retieving data
    By Aaron Longnion in forum authorevents.mitchell
    Replies: 2
    Last Post: 10-16-2000, 08:15 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center