With the code below, when I click the Edit button, the selectvalue in gridview dropdownlist is retained while at the same time, retaining the rest of the dropdownlist values so user can select a different value.
Protected Sub RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs)
    If e.Row.RowType = DataControlRowType.DataRow AndAlso gvCustomers.EditIndex = e.Row.RowIndex Then
        Dim ddlRoles As DropDownList = DirectCast(e.Row.FindControl("ddlRoles"), DropDownList)
        Dim query As String = "select RoleId, Roles from ROLES"
        Dim cmd As New SqlCommand(query)
        ddlRoles.DataSource = GetData(cmd)
        ddlRoles.DataTextField = "Roles"
        ddlRoles.DataValueField = "RoleId"
        ddlRoles.DataBind()
        ddlRoles.Items.FindByValue(TryCast(e.Row.FindControl("lblUserRole"), Label).Text).Selected = True
    End If
End Sub
'//Markup:
<asp:Label ID="lblUserRole" runat="server" Text='<%# Eval("RoleId")%>' Visible = "false"></asp:Label>
<asp:DropDownList ID = "ddlRoles" runat = "server">
</asp:DropDownList>
These work fine for gridview.
However, I would like to change the codebehind to regular web form so I can manipulate the layout out better.
In other words, I have the layout like this:
First Name: _____________
Last Name: ______________
Roles: ________________
My understanding is that in gridview, layout is vertical and is not flexible.
We would like our layout to be horizontal.
Thank you in advance for your assistance