I would like to create the same functionality that Sharepoint provides when you order items using the dropdownlists, as shown in the example below, but I want to create it in asp.net. Example: when column Modified is selected to be the first one, then values of each dropdowlist is reordered automatically using javascript or jquery. Anyone knows how can I do this? I don't have much experience with javascript so I was looking for some help.This is what I have so far:aspx code:\[code\]<asp:GridView ID="GridView1" runat="server" EnableModelValidation="True" AutoGenerateColumns="False" BorderStyle="Solid" RowStyle-Width="1" RowStyle-BorderWidth="1" RowStyle-BorderColor="silver" Width="100%" OnRowEditing="GridView1_RowEditing" onrowcancelingedit="GridView1_RowCancelingEdit" onrowdatabound="GridView1_RowDataBound" DataKeyNames="ID,LanguageID"> <Columns> <asp:TemplateField HeaderText="Ranking" HeaderStyle-HorizontalAlign="Left" SortExpression="Ranking"> <EditItemTemplate> <asp:TextBox ID="TextBox4" runat="server" Text='<%# Bind("Ranking") %>'></asp:TextBox> <aspropDownList ID="ddlRanking" runat="server"> </aspropDownList> </EditItemTemplate> <ItemTemplate> <asp:Label ID="Label4" runat="server" Text='<%# Bind("Ranking") %>'></asp:Label> <aspropDownList ID="DropDownList3" runat="server"> </aspropDownList> </ItemTemplate> <HeaderStyle HorizontalAlign="Left"></HeaderStyle> </asp:TemplateField> </Columns> <RowStyle BorderColor="Silver" BorderWidth="1px" Width="1px"></RowStyle></asp:GridView>\[/code\]Code behind:\[code\]protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { DropDownList ddlLang = (DropDownList)e.Row.FindControl("Dropdownlist2"); if (ddlLang != null) { LanguagesList lang = new LanguagesList(); ddlLang.DataSource = lang.GetAllByLanguageId(); ddlLang.DataTextField = "LanguageName"; ddlLang.DataValueField = "ID"; ddlLang.DataBind(); ddlLang.SelectedValue = http://stackoverflow.com/questions/14069417/GridView1.DataKeys[e.Row.RowIndex].Values[1].ToString(); //ddlLang.Items.FindByValue((Label)(e.Row.FindControl("Label3"))).Selected = true; } DropDownList ddlRanking = (DropDownList) e.Row.FindControl("Dropdownlist3"); if(ddlRanking !=null) { Ranking(ddlRanking); } }}\[/code\]
and this is the result from the code above: