 |
|
 |
In which version of Visual studio are you working.
Is it that hard to post a working project.
|
|
|
|
 |
|
 |
Please help me to edit and change the description, there is no help available for those...
|
|
|
|
 |
|
 |
Hello,
Thank you for reading this article.
I am not sure if there is any built-in feature to support editing. But, you can follow the same approach that you do edit/save in data repeater. Once on a project, we did this. The idea is, when user clicks on the editable field, you need to show a text box to the user. For easy implementation, you can have that text box always, but as hidden. And next when a user clicks for edit, show that text box. Then they should be able to modify it. Upon page submission, you need to find the text inside the text box and cross check it against the previous text and handle accordingly. To find the text box, you need to use the FindControl method on each of the item of the reorder list.
Also, you can do it just by using javascript. So, basically tracking the edits in js and then populating a hidden field with the changes. Then you can persist the change on the server side.
Let me know if you could find the solution.
Had you not been blessed with your eyes, you would miss the colors of life. So, donate posthumous eye and bring color to the lives of the deprived friends.
|
|
|
|
 |
|
 |
Hi Sohan,
I was wondering if you had the chance to explore this control's client side capabilities.
Here is the deal, I'd like to allow users to re-order the list without any postbacks until the next server side event triggers (e.g.submit button) at this time I'd like to be able to read the value of the list (which contains the re-ordered list) and persist it to DB.
Any ideas, how I can make this happen using this Ajax toolkit control ?
Thanks in advance for your time.
Rob.
|
|
|
|
 |
|
 |
Hey Rob,
I also needed the same and wanted to wait till the final submit. But I didn't find a solution at that time. I believe, using the JS class for the reorder list there might be a way to do this. I am sorry that, right now I don't have a reference. I will let you know if I find one.
Thanks for your interest.
Had you not been blessed with your eyes, you would miss the colors of life. So, donate posthumous eye and bring color to the lives of the deprived friends.
|
|
|
|
 |
|
 |
That's alright, thanks for prompt reply.
Robert B.
|
|
|
|
 |
|
 |
I'm not sure of your implementation but I found that I actually don't need the postback on reorder to persist the changes. In fact, this whole example can be done in two events (Page_Load and a button click to display the results). You can re-order all you want on the page and clicking the button will write out the results.
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
List<object> orderedList = DataLayer.GetOrderedListData();
Session["orderedList"] = orderedList;
}
ReorderList1.DataSource = (List<object> )Session["orderedList"];
ReorderList1.DataBind();
}
protected void Button1_Click(object sender, EventArgs e)
{
List<object> orderedList = (List<object> )Session["orderedList"];
divMessage.InnerHtml = "New Ordering <hr />";
foreach (Object item in orderedList)
{
divMessage.InnerHtml += item.Name + " - " + item.Description + " <br />";
}
}
</object></object></object></object>
|
|
|
|
 |
|
 |
So I got the sample working and I can see when I I reorder the list that the section in the Red Box below shows the new order but the part I am missing is how to get the data to actually save back to the database. In the download I don't see this functionality unless it exists within the App_Code directory in the 'ReorderListDemo' which is a Dataset internal info file....
Regardless, I created my own table and everything worked right off the bat but it just doesn't save. I thought about writing a stored procedure that would update the Priority based on the Description passed to it but then you could have two or more Description fields with the same Priority. I guess if you ordered by ItemID then Priority this really wouldn't be an issue but then you won't get the correct order. To get the right order maybe I should order by Priority then ItemID? This seems a little messy. Also how would you handle reordering of multiple items before hitting the Submit changes button?
Help on this would be greatly appreciated!
-Brian
|
|
|
|
 |
|
 |
Thanks very much for this. Exactly what I was looking for.
After changing this for my own app, within SaveWorkItems I had to loop through the workItems List and copy the new current index into my own 'rank' or 'priority' field before the List is placed back into the session object. This way, in btnSubmit_Click when I looped the List again and updated my own table the new values were written back to the database. Otherwise my rank/priority field did not change on the database or in the session object even though it was listed in SortOrderField in the markup. So, bit confused still, but working anyway
|
|
|
|
 |
|
 |
Hi. Great article. I'm using this reorderlist to let the user create a SWOT matrix, and reorder the items by priority. Is it possible to edit the text and/or delete items from the reorderlist? I was thinking something like: ... <itemtemplate> <asp:label id="l1" runat="server" text="<%# Eval("Title") %>" /> <asp:linkbutton id="LinkButton1" runat="server">delete</asp:linkbutton> <asp:linkbutton id="LinkButton2" runat="server">edit</asp:linkbutton> </itemtemplate> ...
|
|
|
|
 |
|
 |
For the most part I've gotten your code working, but I've run into a huge problem. The call to reorderlist1.databind() for some reason causes page_load to get loaded twice! With page.isPostBack returning false! So the code gets executed twice. Due to some features I've needed to add this has caused a huge problem for me. As well it blocks messes up saving, because one of these page_loads is called BEFORE the REORDER_List event. Meaning the databind() gets called first with the old session, and therefore doesn't change until the SECOND time I reorder the list. I've commented out the databind() line and page_load only gets called once. I am using a msterpage, I don't know if that has anything to do with it, but any input would be greatly appreciated.
|
|
|
|
 |
|
 |
I think you may have your ItemReorder event wired up twice. You either set it as a property in your ReorderList (OnItemDataBound="ReorderList1_ItemDataBound") OR if you are using VB.NET you can create an event and add a 'Handles' after it:
Protected Sub ReorderList1_ItemReorder(ByVal sender As Object, ByVal e As AjaxControlToolkit.ReorderListItemReorderEventArgs) Handles ReorderList1.ItemReorder
You can't do both. If you use both then yes, the ItemReorder event will be called twice.
|
|
|
|
 |
|
 |
Wanted to do exactly that so your code was a big help. Changed some of the code to better fit my solution but I kept the basic idea.
Tried using ViewState instead to store the workitems, but it lost the info when pressing save button I didn't have time to look deeper into it.
|
|
|
|
 |
|
 |
First off the sample at the top of this article does not work. I'm not sure if it is supposed to or not, but it sure is presented as if its supposed to work.
Second, I've had absolutely no luck getting this application to run on my own. I'm new to ASP.net and it'd be nice if these articles has some accompanying instructions for populating test database and getting the application to run. I created a database and ran the accompanying script to generate the database table and finally populated it with some data. I then ran the application and I get the following error on Line 36 of WorkItemsHelper.cs: "Invalid object name 'WorkItems'". Wouldn't it be easier just to put an .mdf database file, populated with the test data, in the AppData directory of the sample application?
Third, since I couldn't get the sample application to run I tried to test out some of the code on my own application that runs. My problem is with the following code inside the _ItemReorder event handler:
WorkItemsHelper.SaveWorkItems((List)rlWorkItems.DataSource);
When I examine my own reorderlist's DataSource property inside of my _ItemReorder even handler it is always null. Is this because I'm using an objectdatasource?
-- modified at 14:05 Wednesday 26th September, 2007
|
|
|
|
 |
|
|
 |
|
 |
Hi Daniel,
Is it possible to get a copy of ALL of your code to take a look at? I'm having a hell of a time getting this to work.
My email address is expinch@yahoo.com
|
|
|
|
 |
|
 |
I to have the same problem with the with the datasource always being nothing when the event is fired.
Protected Sub ReorderList1_ItemReorder(ByVal sender As Object, ByVal e As AjaxControlToolkit.ReorderListItemReorderEventArgs) Handles ReorderList1.ItemReorder
'Item Reordered, so save the current order to the Session scope
WorkItemsHelper.SaveWorkItems(DirectCast(sender.DataSource, List(Of WorkItem)))
'This is just in here to see if there was anthing
Dim sb As New StringBuilder
For Each item As WorkItem In WorkItemsHelper.GetWorkItems(72)
sb.Append(item.ToString())
Next
End Sub
Did you work out why?
|
|
|
|
 |
|
 |
wakefib,
Yes I figured out why the DataSource was null inside of my ItemReorder event, although I'm not sure if this is your problem.
My problem is that I was using an objectdatasource and was attaching this datasource to my ReorderList through the DataSourceID property of the ReorderList. Because I was doing this, I didn't think I needed the code in the Page_Load which explicitly binds the WorkItems to the ReorderList. This was the problem.
Apparently, if you're using a DataSourceID, the data gets bound to the control AFTER the ItemReorder event is fired. Because of this, when you check for the DataSource in the ItemReorder event, it will be null because it hasn't been set yet. So, what I did to resolve the problem was remove the DataSourceID from my ReorderList, then bind to it in the Page_Load as described in the sample application. This fixed the problem.
The binding must take place in EVERY Page_Load, so also make sure not to place a conditional {if (!this.IsPostBack)} around this code.
Let me know if this solves your problem.
|
|
|
|
 |
|
 |
I am sorry that you could not run the application. But I have this implementation on a production code and its working perfectly.
I believe you are missing something and its unjust to allegedly say something like 'it doesn't work'! Send me your version that you are saying is not working and I will show you what's missing there.
I wish you will take some time and modify the grossly misleading message. Its bad.
Had you not been blessed with your eyes, you would miss the colors of life. So, donate posthumous eye and bring color to the lives of the deprived friends.
|
|
|
|
 |
|
 |
doesnt work for me either. the order is always set to the default database order and not saved...
|
|
|
|
 |
|
 |
I don't have any idea why its not working for you. But I suggest you take a look at your implementation and see if it matches with mine. The key part is maintaining the order changes in the session. I tried my solution several times and it works rightly. In fact, this is taken from a commercial project where I worked and the software is still in use for over 2 years. Anyway, write to me if you could find the issue.
Had you not been blessed with your eyes, you would miss the colors of life. So, donate posthumous eye and bring color to the lives of the deprived friends.
|
|
|
|
 |
|
 |
Are any of the fields in the table listed as primary keys or auto-increments?
|
|
|
|
 |