Hi, thanks for looking at my question.
I am building a web application and am using a gridview to show data and allow the user to change this data.
I have my gridview and within it I have a dropdown list that shows data from an SQL table, the dropdown list's datasource is set programatically (see code below) and this works fine.
At the moment the dropdown list shows everything in the table but I would like the selected value to be what is in the datagrid data.
Please see the attached code and screenshot.
(the screenshot shows the datagrid showing the data but the dropdown list is showing UK Helpdesk which is the first record in the lookup table, this needs to show the value from the datagrod table)
I hope this makes sense, if not, please ask me any questions
<asp:DropDownList ID="ddlGroup" runat="server" DataSource=<%#PopulateGroups() %> DataTextField="Description" DataValueField="Group_ID" />
public DataTable PopulateGroups()
string sConnString = WebConfigurationManager.ConnectionStrings["HelpdeskConnectionString"].ConnectionString;
SqlConnection connSQLH = new SqlConnection(sConnString);
SqlDataAdapter adGroup = new SqlDataAdapter("SELECT Group_ID, Description FROM HD_LU_GROUPS WHERE (Lang_Code = '" + Session["Language"].ToString() + "')", connSQLH);
DataTable dtG = new DataTable();