?
Solved

Strange problem, same page not working on different server (command in datagrid)

Posted on 2007-07-28
6
Medium Priority
?
227 Views
Last Modified: 2010-04-15
Hi,

I have the following piece of code:

ASPX:

<asp:DataGrid ID="ProductsView" runat="server" PagerStyle-PrevPageText="Prev" PagerStyle-NextPageText="Next"
                        PagerStyle-HorizontalAlign="Right" OnPageIndexChanged="ProductsView_PageChange"
                        PagerStyle-CssClass="heading" PagerStyle-Visible="true" PageSize="10" PagerStyle-Mode="NumericPages"
                        PagerStyle-Position="Bottom" AlternatingItemStyle-CssClass="graylight" ItemStyle-CssClass="bluelight"
                        HeaderStyle-CssClass="blueheader_big" Width="95%" AutoGenerateColumns="False"
                        AllowSorting="True" HeaderStyle-Font-Bold="True" HeaderStyle-ForeColor="White"
                        CssClass="DataGrid" ShowHeader="True" CellSpacing="0" CellPadding="4" BorderWidth="0">
                        <AlternatingItemStyle CssClass="graylight"></AlternatingItemStyle>
                        <ItemStyle CssClass="bluelight"></ItemStyle>
                        <HeaderStyle Font-Bold="True" ForeColor="White" CssClass="blueheader_big"></HeaderStyle>
                        <Columns>
                            <asp:TemplateColumn>
                                <HeaderTemplate>
                                    Position
                                </HeaderTemplate>
                                <ItemTemplate>
                                    <%=rowCount%>
                                </ItemTemplate>
                            </asp:TemplateColumn>
                            <asp:BoundColumn DataField="name" SortExpression="name" HeaderText="Category Name"></asp:BoundColumn>
                            <asp:TemplateColumn ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center">
                                <HeaderTemplate>
                                    Sort
                                </HeaderTemplate>
                                <ItemTemplate>
                                    <nobr>
                                        <%if (rowCount > 0)
             { %>
                                        <asp:ImageButton ID="MoveUpEnd_Button" runat="server" ImageUrl="imgs/upend.gif" CommandName="MoveUpEnd"
                                            CommandArgument='<%# DataBinder.Eval(Container.DataItem, "position") %>' OnCommand="MoveCommandHandler">
                                        </asp:ImageButton>
                                        <asp:ImageButton ID="MoveUp_Button" runat="server" ImageUrl="imgs/up.gif" CommandName="MoveUp"
                                            CommandArgument='<%# DataBinder.Eval(Container.DataItem, "position") %>' OnCommand="MoveCommandHandler">
                                        </asp:ImageButton>
                                        <%} if (rowCount < ProductsView.Items.Count - 1)
             { %>
                                        <asp:ImageButton ID="MoveDown_Button" runat="server" ImageUrl="imgs/down.gif" CommandName="MoveDown"
                                            CommandArgument='<%# DataBinder.Eval(Container.DataItem, "position") %>' OnCommand="MoveCommandHandler">
                                        </asp:ImageButton>
                                        <asp:ImageButton ID="MoveDownEnd_Button" runat="server" ImageUrl="imgs/downend.gif"
                                            CommandName="MoveDownEnd" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "position") %>'
                                            OnCommand="MoveCommandHandler"></asp:ImageButton>
                                        <%} rowCount = rowCount + 1;%>
                                    </nobr>
                                </ItemTemplate>
                            </asp:TemplateColumn>
                        </Columns>
                        <PagerStyle NextPageText="Next" PrevPageText="Prev" HorizontalAlign="Right" CssClass="heading"
                            Mode="NumericPages"></PagerStyle>
                    </asp:DataGrid>




C# (just one example):

public void MoveCommandHandler(object sender, CommandEventArgs e)
        {
            int next = -1;
            int next_id = -1;
            DataSet myDataSet = new DataSet();
            DataRowCollection dra;
            string categWhere = "";
            if (tid != -1)
                categWhere = "parentCategory=" + tid;
            else
                categWhere = "parentCategory is null";

            if (e.CommandName == "MoveDown")
            {

                string sql = "Select TOP 1 id, [position] From Categories WHERE " + categWhere + " AND [position] >" + e.CommandArgument + " ORDER BY [position]";
                myDataSet = DBConn.select(sql);
                dra = myDataSet.Tables[0].Rows;
                foreach (DataRow dr in dra)
                {
                    next = ((int)dr["position"]);
                    next_id = ((int)dr["id"]);
                }

                sql = "UPDATE Categories SET [position]=" + next + " WHERE " + categWhere + " AND [position]=" + e.CommandArgument;
                DBConn.submit(sql);

                sql = "UPDATE Categories SET [position]=" + e.CommandArgument + " WHERE id=" + next_id;
                DBConn.submit(sql);

            }
Response.Redirect("order_categories.aspx?tid=" + tid);
        }


My problem is that this page runs perfectly on one server and does not do anything on another server.
When you click the imagebutton, on server1 the changes are submitted, on server2 it does nothing.

Any ideas why this might happen?
0
Comment
Question by:infodigger
  • 3
  • 3
6 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 19584299
1) I am going to assume that you are talking about 1.1, since you have a DataGrid.

2) What is the difference between the two servers (IIS version, O/S, etc.)?

Bob
0
 

Author Comment

by:infodigger
ID: 19584329
1) The first server has both versions of .Net installed (1.1 and 2). However in IIS I have chosen v2 to run the website. Server2 has only v2 installed.
2) Server1 runs SQL 2000, server2 2005 express. However I tried all the queries and they run fine. I suppose the 1st case might be the problem. Was datagrid abandoned on asp.net 2?

Thanks a lot!
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 19584351
1) If you developed the site for 1.1, and you are trying to run on 2.0 only, the results are not necessarily predictable.

2) For backwards compatibility, 2.0 still supports DataGrid.

3) If this is a 1.1 site, can you install 1.1 on server #2?

Bob
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:infodigger
ID: 19584564
Bob,

Will the installation of 1.1 cause any problems to other applications running on the server using 2? I suppose that it does not install as default on IIS over the existing version, is that right?

The Datagrid apears correctly but the event commands are not fired.
0
 
LVL 96

Accepted Solution

by:
Bob Learned earned 2000 total points
ID: 19584602
I haven't installed 1.1 after 2.0.  It might change the version of .NET framework for the 2.0 web sites.  It can be easily fixed through the IIS console app on the ASP.NET tab.  

The two frameworks are independent of each other and can both run on the same box.

Bob
0
 

Author Comment

by:infodigger
ID: 19584735
Bob,

I can see asp.net 1.1 installed on the computer but I can't find the ASP.NET tab at the IIS. On the server1 is active but on server2 is nowhere!
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

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

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses
Course of the Month14 days, 9 hours left to enroll

839 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