3
Answers

GridView1_SelectedIndexChanging

Ask a question
Rashid Khan

Rashid Khan

14y
5.8k
1
Helloo friend.
i m facing problem in GridView1_SelectedIndexChanging.
i have grid view it contains data . now i want that when user press select button. then complete details data show in detail view control of the particular dataID.
i use templates in grid view.,

PersonalAddBookBE objPersonalBE = new PersonalAddBookBE();
       
        objPersonalBE.PersonalInfoId =Convert.ToInt32(GridView1.Rows[e.NewSelectedIndex].Cells[1].Text);
        PersonalAddBookBL objPersonalBL = new PersonalAddBookBL();
        DataSet ds = new DataSet();
        ds = objPersonalBL.SelectAllPersonalAddBook(objPersonalBE);
        DetailsView1.DataSource = ds;
        DetailsView1.DataBind();

i m doing this and error comes in this line?
objPersonalBE.PersonalInfoId =Convert.ToInt32(GridView1.Rows[e.NewSelectedIndex].Cells[1].Text);
(Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.FormatException: Input string was not in a correct format.
)
can anyone tell me how to assign row so tht function take in give complete detail in detailview.
i m using templates field in GV nd its n tire project
Thanks in advance



Answers (3)