Solved

Obtaining Text from GridView Text Box in edit mode from RowUpdating event.

Posted on 2006-11-28
6
406 Views
Last Modified: 2008-02-01
I am trying to obtain Text from GridView Text Box in edit mode from RowUpdating event. I tried to use a posted solution:

CType(e.Row.Rows(e.RowIndex).Cells(2).Controls(0), TextBox).Text

I get the following error...
Error      3      'Row' is not a member of 'System.Web.UI.WebControls.GridViewUpdateEventArgs'.

The example posted used "ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs" and somehow resolved this.... I am using .NET 2.0

Also, I am doing this from a constructed data set and not directly to a database!

Thanks!
0
Comment
Question by:pauljcaron
6 Comments
 
LVL 9

Assisted Solution

by:kraffay
kraffay earned 100 total points
ID: 18032300
Can you try this:

Ctype(yourGridName.Rows(e.RowIndex).Cells(2).Controls(0), TextBox).Text

0
 

Author Comment

by:pauljcaron
ID: 18032585
I tried the suggested line which resulted in a cast exception. I changed TextBox to Label and retrieved the original value. Not sure where to go from here since the TextBox is in the display.
0
 
LVL 9

Assisted Solution

by:kraffay
kraffay earned 100 total points
ID: 18032634
You may have to play around with the indexes of the cells and controls to get a handle to the textbox.  Usually the Gridviw puts a label, a text, and another label in each cell.
0
 
LVL 5

Assisted Solution

by:hfpon
hfpon earned 20 total points
ID: 18033555
Perhaps you want to tell us the problem you are facing, not focus on the solution you think that will work.....
We may be able to help you further then....

Can you post your code and what you want to do with it?
0
 
LVL 9

Accepted Solution

by:
bele04 earned 380 total points
ID: 18034597
Why don't you try using the FindControl() method and see if your textbox is there:

TextBox tb = CType(yourGridName.Rows(e.RowIndex).FindControl("<id_of_your_textBox>"), TextBox)

if(tb != null)
{
    //Textbox is found.
    //Do processing stuff here.
}
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

789 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question