从gridview中的Dropdownlist将数据保存到数据库
问题描述:
我有一个gridview,其中有10列,其中一个是下拉列表我想从中获取所选值并保存在数据库的特定列中,我想知道如何以及在何处访问此下拉列表。如果有代码那将是有用的plzzz帮助
i'm having a gridview in which it has 10 columns and one of which is a dropdown i wanna take the selected value from it and save in a specific column of a database i wanna know how and where to access this dropdownlist. if there is a code it will be useful plzzz help
答
简单,请按照下面的代码
its simple, please follow the below code
DropDownList lstuserName = (DropDownList)gvRow.FindControl("ddl_groub");
Response.Write("Selected Value : " + lstuserName.SelectedValue + " " + "Selected Item : " + lstuserName.SelectedItem.Text);