Click here to Skip to main content
15,883,623 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to retrive data to a gridview in editable mode in gridveiw i have 1row wch consists of 3 dropdwn list and 3 textboxes when i'm clickin on edit button i'm not getting the previous data whch alredy present in that row
Posted
Comments
Member 10687815 21-Mar-14 3:04am    
how to retrive data to a gridview in editable mode in gridveiw i have 1row wch consists of 3 dropdwn list and 3 textboxes when i'm clickin on edit button i'm not getting the previous data whch alredy present in that row any help plz
Dinesh.V.Kumar 21-Mar-14 3:06am    
Did u bind again when you clicked "Edit" button?


To get the SelectedValue of Dropdownlist in Edit Mode, use the below code in RowDataBound Event,

C#
DataRowView drv = (DataRowView)e.Row.DataItem;
if (e.Row.RowType == DataControlRowType.DataRow)
{
   if ((e.Row.RowState & DataControlRowState.Edit) > 0)
   {
      DropDownList ddl= (DropDownList )e.Row .FindControl ("DropDownList1");
      ddl.SelectedValue = drv[3].ToString();
   }
}
 
Share this answer
 
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900