CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    May 2000
    Posts
    64

    How can I get Value from selected row in datagrid

    Hello Everyone

    I have been trying to get the value from selected row in Datagrid for ASP.NET, I have been looking everywhere for some code but without result, how can I do this

    Thanks in Advance


    Jon Sveinsson

  2. #2
    Join Date
    Mar 2002
    Location
    Alpharetta, GA
    Posts
    51
    I haven't used the datagrid in this way yet but this will probably work:

    TextBox txt = (TextBox)dg.Items[dg.SelectedIndex].Controls[myTextID];

    string val = txt.Text;

    (where dg is a reference to your datagrid)

  3. #3
    Join Date
    Feb 2003
    Posts
    8
    if you're working with VB this should work
    Dim GridValue as string = CType(e.Item.Cells(0).Controls(0), TextBox).Text

    GridValue being the variable for the new value you're trying to get. e.Item.Cells(0) the number within those paranthesis corresponds to column you're trying to get to.


    hope this helps

    guyute

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured