retrive value from form

Discussion in 'ASP .Net Datagrid Control' started by TJS, Oct 19, 2003.

  1. TJS

    TJS Guest

    how do I determine what is being returned from form to prevent error
    getting error of:

    System.InvalidCastException: Specified cast is not valid.
    Line 95: Dim custName As String =
    CType(e.Item.Cells(3).Controls(0), TextBox).Text
    TJS, Oct 19, 2003
    #1
    1. Advertising

  2. TJS

    Alvin Bruney Guest

    This means that the control being referred to at Cells[3] is not a text box.
    Do a gettype on that control first, it will tell you what animal it is. You
    probably are referring to the wrong cell.

    --


    -----------
    Got TidBits?
    Get it here: www.networkip.net/tidbits/default.htm

    "TJS" <> wrote in message
    news:uw7$...
    > how do I determine what is being returned from form to prevent error
    > getting error of:
    >
    > System.InvalidCastException: Specified cast is not valid.
    > Line 95: Dim custName As String =
    > CType(e.Item.Cells(3).Controls(0), TextBox).Text
    >
    >
    >
    >
    >
    Alvin Bruney, Oct 20, 2003
    #2
    1. Advertising

  3. TJS

    TJS Guest

    there's 4 columns in the grid and the text box is column 4 (hence cell 3)

    template has this as field type:

    <EditItemTemplate>
    <asp:TextBox runat="server" Text='<%# DataBinder.Eval(Container,
    "DataItem.CustName") %>'></asp:TextBox>
    </EditItemTemplate>
    TJS, Oct 20, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Tony Dong
    Replies:
    0
    Views:
    450
    Tony Dong
    Dec 20, 2005
  2. dee
    Replies:
    0
    Views:
    1,908
  3. weiwei
    Replies:
    0
    Views:
    1,001
    weiwei
    Jan 5, 2007
  4. news.west.cox.net

    Retrive top value for div

    news.west.cox.net, Apr 12, 2005, in forum: Javascript
    Replies:
    1
    Views:
    90
  5. Zhang Weiwu
    Replies:
    4
    Views:
    101
Loading...

Share This Page