Edit row programmatically with gridview

Posted on 2006-04-20
Last Modified: 2012-05-05
Hi expert

i need to update a row programmatically

i use the gridview_updating handle but i don't how to retrieve the value edited

how can i do that

it's quiet urgent, thank you in advance

Question by:Dnx_7
    LVL 37

    Accepted Solution

    use "findcontrol"

    string firstName = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("txtFirstName")).Text;

    dim tb as textbox = new textbox
    tb =GridView1.Rows(e.RowIndex).FindControl("txtFirstName")
    dim firstName as string = tb.text

    you now have the string "firstName" to use in your update code
    LVL 2

    Author Comment

    i don't know how the id of the textbox of the gridview?

    how can you retrieve it?

    LVL 2

    Author Comment

    do u have sample code?

    i'm stuck...

    LVL 2

    Author Comment

    ok i find the solution :

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

    thanks to put me on the right way


    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Join & Write a Comment

    One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on could not pull conte…
    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…
    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.
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    728 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

    20 Experts available now in Live!

    Get 1:1 Help Now