View Single Post
Old May 4th, 2007, 06:04 AM
mahboob_sabir mahboob_sabir is offline
Registered User
Join Date: May 2007
Location: Islamabad, As, Pakistan.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to mahboob_sabir Send a message via AIM to mahboob_sabir Send a message via MSN to mahboob_sabir Send a message via Yahoo to mahboob_sabir
Default gettting data from gridview in edit mode text cont

actually i want to get data for updaion in edit mode how i can data from text control when row in edit mode and click the update button

there is code through which i m trying bu t this code give me data which is in cell not in test box place over cell in edit mode

public void UpdateGridRecord()
        string firstname;
        string lastname;
        string city;
        string pid;
        //pid = gvPerson.Rows[RowToChange].Cells[1].Text;
        //firstname = Convert.ChangeType(gvPerson.Rows[RowToChange].Cells[2].Controls[0], TextBox).ToString();
        if (Convert.ChangeType(gvPerson.Rows[RowToChange].Cells[2].Controls[0], typeof(TextBox)) != null)
            firstname = ((TextBox)gvPerson.Rows[RowToChange].Cells[2].Controls[0]).Text;
        if (Convert.ChangeType(gvPerson.Rows[RowToChange].Cells[3].Controls[0], typeof(TextBox)) != null)
            lastname = ((TextBox) Convert.ChangeType(gvPerson.Rows[RowToChange].Cells[3].Controls[0],typeof(TextBox))).Text;
        if (Convert.ChangeType(gvPerson.Rows[RowToChange].Cells[4].Controls[0], typeof(TextBox)) != null)
            city = ((TextBox)gvPerson.Rows[RowToChange].Cells[4].Controls[0]).Text;

        //txtChildName = CType(grdchildgrid.Rows(intRowId).Cells(3).Control s(0), TextBox).Text

        DSPerson.UpdateParameters["personid"].DefaultValue = pid;
        DSPerson.UpdateParameters["firstname"].DefaultValue = firstname;
        DSPerson.UpdateParameters["lastname"].DefaultValue = lastname;
        DSPerson.UpdateParameters["city"].DefaultValue = city;

please help me