Solved

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

Posted on 2006-11-28
6
398 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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

747 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now