.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Melody Anderson
Eminent IT

Home >> Code Snippets >> ASP.NET Controls >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Ajax reorder list control

Posted By:Maverick       Posted Date: March 07, 2011    Points: 40    Category: ASP.NET Controls    URL: http://www.dotnetspark.com  

How to use ajax reorder list control

Hello All,

Some time we need to reorder some items in our application to reorder the items and store the order into the database. Below is the ajax reorder control which will allow you to do it.

                                                            <%--This is a template for the items to be reordered.--%>
<%--This template will show up if there were no items in the database to reorder.--%>
No items exist.
<%-- --%>
Code side events. //for input parameters protected void dbOrder_Selecting(object sender, ObjectDataSourceSelectingEventArgs e) { e.InputParameters["Id"] = Convert.ToInt32(QueryStringId); } //for getting checkbox state protected void chkBox_CheckedChanged(object sender, EventArgs e) { for (int i = 0; i < ReorderList1.Items.Count; i++) { Section objReport = new Section(); objReport.Id = Convert.ToInt32(ReorderList1.DataKeys[i].ToString()); objReport.IsChecked = ((System.Web.UI.WebControls.CheckBox)(ReorderList1.FindControl("_rli" + Convert.ToString(i)).FindControl("chkBox"))).Checked; objReport.ReportSection = ((System.Web.UI.WebControls.Label)(ReorderList1.FindControl("_rli" + Convert.ToString(i)).FindControl("lblReportSection"))).Text; objReport.Order = Convert.ToInt32(((System.Web.UI.WebControls.Label)(ReorderList1.FindControl("_rli" + Convert.ToString(i)).FindControl("lblorder"))).Text); Section.Update(objReport.Id, objReport.ReportSection, objReport.Order, objReport.IsChecked); } }

Hope this helps.



Further Readings:


No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend