Solved

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

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
A company’s greatest vulnerability is their email. CEO fraud, ransomware and spear phishing attacks are the no1 threat to a company’s security. Cybercrime is responsible for the largest loss of money to companies today with losses projected to r…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

932 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

10 Experts available now in Live!

Get 1:1 Help Now