Solved

Reorderlist not working on MySQL using sqldatasource

Posted on 2009-07-07
1
596 Views
Last Modified: 2012-05-07
Hi,
I want to the reorderlist with a MySQL database using sqldatasource as the connectors. I'd tried it on editting in Gridview, connecting to the same sqldatasource, and it's working (database can be editted).

However using the same sqldatasource, it is not working on the reorderlist (on the webpage, you can reorder the item, but not getting updated in database).

Anything missing from my code attached? Any help is much appreciated.

<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server"/>
        
    <%--reorderlist, after reordering, the database is not being updated--%>
    <cc1:ReorderList ID="ReorderList1" runat="server"
                DataKeyField="id"
                AllowReorder="true" 
                PostBackOnReorder="true"
                DataSourceID="Sqldatasource1" 
                SortOrderField="order_no">
             
       <ItemTemplate>
            <asp:Label ID="Label1" runat="server" Text='<% #Eval("name") %>'></asp:Label>
            <asp:Label ID="Label2" runat="server" Text='<% #Eval("order_no") %>'></asp:Label>
       </ItemTemplate>    
                        
        <DragHandleTemplate>
            <div style="height: 20px; width: 20px; border: solid 1px black; background-color: Red; cursor: pointer;">
            </div>
        </DragHandleTemplate>
        <ReorderTemplate>
            <div style="width: 300px; height: 20px; border: dotted 2px black;">
            </div>
        </ReorderTemplate>                        
    </cc1:ReorderList>
                
    <%--sqldatasource--%>
    <asp:sqldatasource ID="Sqldatasource1" runat="server"
            ConnectionString="Database=muncchdb;Data Source=localhost;User Id=muncchco;Password=muncchco1;charset=utf8"
            ProviderName="MySql.Data.MySqlClient" 
            SelectCommand="SELECT id, name, order_no FROM reorder ORDER BY order_no"
            UpdateCommand="update reorder set order_no=?order_no where id=?id">
       <UpdateParameters>
                <asp:Parameter Name="id" Type="Int32" />
                <asp:Parameter Name="order_no" Type="Int32" />
       </UpdateParameters>        
    </asp:sqldatasource>
        
    <%--The gridview is working, can be editted, to prove that the sqldatasource is called/connected right--%>
    <asp:GridView ID="GridView1" runat="server" DataKeyNames="id" DataSourceID="Sqldatasource1" AutoGenerateEditButton="true">
    </asp:GridView>
        
    </form>
</body>

Open in new window

reorderlist.jpg
0
Comment
Question by:tangteng78
1 Comment
 
LVL 96

Accepted Solution

by:
Bob Learned earned 500 total points
ID: 24805591
I don't see where there would be anything that forces the SqlDataSource to call the UpdateCommand.

You can test with the SqlDataSource.Updating event handler:

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.sqldatasource.updating.aspx

and, you can manually force an update with the SqlDataSource.Update method.
Sub On_Click(ByVal source As Object, ByVal e As EventArgs)
        SqlDataSource1.Update()
 End Sub 'On_Click

Open in new window

0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
VB.NET 2008 Winforms Signing 13 30
Where is this file? 3 25
SQL querys that gives me from one table into another. 2 23
Formating field inside mysql query 2 10
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question