473,386 Members | 1,712 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

ReorderList with ObjectDataSource not updating the List

210 Expert 100+
I have a ajax reorderlist that displays the contents with out any problems but when i drag and reorder the list nothing happens, i get a postback and the same initial list is displayed, seems like my update method is not working or being called. I have read through multiple articles that states that all the parameters needs to be passed in if objectdatasource is being used, I followed the instructions that i could get through google none worked for me. Please advice.

Here is my page setup code:

Expand|Select|Wrap|Line Numbers
  1. <cc1:ReorderList ID = "reorderlst" runat="server" PostBackOnReorder="True" SortOrderField="ListOrder"
  2.     DataKeyField="T_id" DataSourceID = "odslist" AllowReorder ="True" >
  3.     <ItemTemplate>
  4.         <div class ="itemArea">
  5.             <table style="border-bottom: solid 1px #C0C0C0">
  6.                 <tr id ="rowReorderItem">
  7.                     <td>
  8.                         <asp:Label ID ="lblListorder" runat="server" Text='<%# HttpUtility.HtmlEncode(Convert.ToString(Eval("ListOrder"))) %>' />
  9.                     </td>
  10.                     <td>
  11.                          <asp:Label ID ="lbltitle" runat="server" Text='<%# HttpUtility.HtmlEncode(Convert.ToString(Eval("Title"))) %>' />
  12.                          <asp:Label ID ="lblid" runat="server" Text='<%# HttpUtility.HtmlEncode(Convert.ToString(Eval("T_id"))) %>' />
  13.                     </td>
  14.                 </tr>
  15.             </table>
  16.         </div>
  17.     </ItemTemplate>
  18.     <EmptyListTemplate>
  19.         <div>
  20.             <strong> No task exists</strong>
  21.         </div>
  22.     </EmptyListTemplate>
  23.     <ReorderTemplate>
  24.         <asp:Panel ID="pnlReorder" runat="server" CssClass="reorderCue">
  25.         </asp:Panel>
  26.     </ReorderTemplate>
  27.     <DragHandleTemplate>
  28.         <asp:Image ID="imgReorder" runat="server" AlternateText ="move" ToolTip="Click and drag to reorder" ImageUrl="~/images/reorder.gif" />
  29.  
  30.     </DragHandleTemplate>
  31.  
  32. </cc1:ReorderList>
  33.  
  34.  
  35. <asp:ObjectDataSource ID ="odslist" runat="server" SelectMethod="GetList" TypeName="fizmo.TodoList" 
  36.     UpdateMethod="ReorderTodoList" OnSelecting="odslist_Selecting" >
  37.         <SelectParameters>
  38.             <asp:Parameter Name="agentid" Type="Int32" />
  39.         </SelectParameters>
  40.         <UpdateParameters> 
  41.  
  42.             <asp:Parameter Name ="listid" Type="Int32" />
  43.             <asp:Parameter Name = "Title" Type="String" />
  44.             <asp:Parameter Name="listorder" Type="Int32" />
  45.             <asp:Parameter Name="agentid" Type="Int32" /> 
  46.         </UpdateParameters>
  47. </asp:ObjectDataSource>
  48.  
  49.  

Here is by code behind

Expand|Select|Wrap|Line Numbers
  1.  
  2.  protected void odslist_Selecting(object sender, ObjectDataSourceSelectingEventArgs e)
  3.     {
  4.         Agent agt = new Agent(User.Identity.Name.ToString());
  5.         e.InputParameters["agentid"] = agt.getagentid();
  6.     }
  7.  
  8.  
Here is by class for objectdatasource to refer

Expand|Select|Wrap|Line Numbers
  1. namespace fizmo
  2. {
  3.     public class TodoList
  4.     {
  5.         //data members
  6.         private int _id;
  7.         private string _title;
  8.         private string _details;
  9.         private DateTime _creationdate;
  10.         private DateTime _expirationdate;
  11.         private int _agentid;
  12.         private ListPriority _priority;
  13.         private int _ListOrder;
  14.  
  15.         //constructors
  16.         public TodoList() { }
  17.         public TodoList(string TodoTitle, string TodoDetails, DateTime Todocreationdate, DateTime Todoexpirationdate, int Todoagentid, ListPriority TodoPriority, int ListOrder)
  18.         {
  19.             this.Title = TodoTitle;
  20.             this.Details = TodoDetails;
  21.             this.CreationDate = Todocreationdate;
  22.             this.ExpirationDate = Todoexpirationdate;
  23.             this.AgentID = Todoagentid;
  24.             this.Priority = TodoPriority;
  25.             this.ListOrder = ListOrder;
  26.         }
  27.         public TodoList(string TodoTitle, string TodoDetails, DateTime Todocreationdate, DateTime Todoexpirationdate, int Todoagentid, ListPriority TodoPriority)
  28.         {
  29.             this.Title = TodoTitle;
  30.             this.Details = TodoDetails;
  31.             this.CreationDate = Todocreationdate;
  32.             this.ExpirationDate = Todoexpirationdate;
  33.             this.AgentID = Todoagentid;
  34.             this.Priority = TodoPriority;
  35.  
  36.         }
  37.  
  38.  
  39.         public TodoList(string TodoTitle,DateTime Todocreationdate, DateTime Todoexpirationdate, int Todoagentid, ListPriority TodoPriority)
  40.         {
  41.             this.Title = TodoTitle;            
  42.             this.CreationDate = Todocreationdate;
  43.             this.ExpirationDate = Todoexpirationdate;
  44.             this.AgentID = Todoagentid;
  45.             this.Priority = TodoPriority;
  46.         }
  47.  
  48.         public TodoList(int Todoid)
  49.         {
  50.             this.TodoID = Todoid;
  51.         }
  52.  
  53.  
  54.         //getter n setters
  55.  
  56.         public int ListOrder
  57.         {
  58.             get { return _ListOrder; }
  59.             set { _ListOrder = value; }
  60.         }
  61.  
  62.         public int TodoID
  63.         {
  64.             get { return _id; }
  65.             set { _id = value; }
  66.         }
  67.  
  68.         public string Title
  69.         {
  70.             get { return _title; }
  71.             set { _title = value; }
  72.         }
  73.  
  74.         public string Details
  75.         {
  76.             get { return _details; }
  77.             set { _details = value; }
  78.         }
  79.  
  80.         public DateTime CreationDate
  81.         {
  82.             get { return _creationdate; }
  83.             set { _creationdate = value; }
  84.         }
  85.  
  86.         public DateTime ExpirationDate
  87.         {
  88.             get { return _expirationdate; }
  89.             set { _expirationdate = value; }
  90.         }
  91.  
  92.         public int AgentID
  93.         {
  94.             get { return _agentid; }
  95.             set { _agentid = value; }
  96.         }
  97.  
  98.         public ListPriority Priority
  99.         {
  100.             get { return _priority; }
  101.             set { _priority = value; }
  102.         }
  103.  
  104.  
  105.         public void ReorderTodoList(int listid, string Title, int listorder,int agentid)
  106.         {
  107.             string strsql = " Update Thingstodo set Listorder = @list where T_id = @listid";
  108.  
  109.             SqlConnection conn = new SqlConnection();
  110.             String constr = ConfigurationManager.ConnectionStrings[("USBSRVR")].ConnectionString;
  111.             conn = new SqlConnection(constr);
  112.  
  113.             SqlCommand cmd = new SqlCommand(strsql, conn);
  114.             cmd.Parameters.Add("@list", SqlDbType.Int).Value = listorder;
  115.             cmd.Parameters.Add("@listid", SqlDbType.Int).Value = listid;
  116.  
  117.             try
  118.             {
  119.                 conn.Open();
  120.                 cmd.ExecuteNonQuery();
  121.  
  122.             }
  123.             catch (Exception ex)
  124.             {
  125.                 throw ex;
  126.             }
  127.             finally
  128.             {
  129.                 conn.Close();
  130.             }
  131.  
  132.         }
  133.  
  134.  
  135.         public DataSet GetList(int agentid)
  136.         {
  137.             DataSet list = new DataSet();
  138.             string strsql = " Select T_id, Title, Listorder from Thingstodo where Agentid= " + agentid + " and expirationdate >= " + DateTime.Now.ToShortDateString();
  139.  
  140.             SqlConnection conn = new SqlConnection();
  141.             String constr = ConfigurationManager.ConnectionStrings[("USBSRVR")].ConnectionString;
  142.             conn = new SqlConnection(constr);
  143.             try
  144.             {
  145.                 SqlCommand cmd = new SqlCommand(strsql, conn);
  146.                 SqlDataAdapter da = new SqlDataAdapter(cmd);
  147.  
  148.                 da.Fill(list);
  149.  
  150.             }
  151.             catch (Exception ex)
  152.             {
  153.                 throw ex;
  154.             }
  155.             finally
  156.             {
  157.                 conn.Close();
  158.             }
  159.             return list;
  160.         }
  161.  
  162.  
  163.  
  164.     }
  165.  
  166.  
Help!!!!
Aug 12 '09 #1
3 4339
semomaniz
210 Expert 100+
Please help, I still cannot figure out why the reorderlist is not updating
Aug 13 '09 #2
semomaniz
210 Expert 100+
Can anyone put some thoughts on this please?
Aug 14 '09 #3
semomaniz
210 Expert 100+
any one has any idea on this please advice
Aug 18 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Mantorok | last post by:
Hi all I have a ListControland it is updated by client-side script, the client script adds a new item and gives it a value and a key. The problem is when it's posted back the server the items...
0
by: Evert Wiesenekker | last post by:
I am struggling with the following situation : Suppose I have an Object model of a house. The house can contain 0 or more chairs. Lets say the House class looks like this: class House {...
0
by: Mark Micallef | last post by:
Hi, I'm having a problem using a databound dropdownlist inside a reorderlist ajax control. Here's a snippet of the code I'm using: <InsertItemTemplate> <div class="insertArea">...
1
by: Mark Micallef | last post by:
Hi, this question relates to a control in the Ajax toolkit for asp.net 2. I'm having a problem using a databound dropdownlist inside a reorderlist ajax control. Here's a snippet of the code I'm...
0
by: =?Utf-8?B?R2hpc3Rvcw==?= | last post by:
Hi all, I have a class with properties returning int, string, date... and generic Lists of other classes. private static string zipcode; private static string city; private static double?...
2
by: Spam Catcher | last post by:
Hi All, I want to bind a datagridview or ListView to a List that is constantly being updated (items are added/removed all the time). Any ideas what the best way is to do this? I tried binding...
1
by: Max2006 | last post by:
Hi, I am truing to find a pattern for my Business Logic Layer to be able to work fine win ObjectDataSource's Update method. The challenge is ObjectDataSource is not able to work with an...
4
by: Organizer | last post by:
I am using Microsoft Access 2007. I have a list in a dropdown combobox (Field_One) in a form (Form_One). Users have the option to click a button if the item they need does not appear in the combobox,...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.