从 asp.net 3.5 windows 2003 迁移到 asp.net 4.0 windows 2008 后,javascript(也许还有 Ajax)无法工作

发布于 2024-12-04 20:58:43 字数 2112 浏览 0 评论 0原文

我有一个 ASP.NET Web 表单应用程序,现在需要将其移至 Windows 2008 服务器。

当前版本使用asp.net 3.5。在新的服务器(windows 2008)上,一些javascripts似乎不起作用。页面中的控件环绕并更新面板。当我按确定时,选择在网格视图列上启动的单选按钮后,如下所示。

private void InitCheckBoxes(GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{


Literal output = (Literal)e.Row.FindControl("RadioButtonMarkup");

StringBuilder sb = new StringBuilder();
sb.Append("<input type=");
sb.Append(@"");
sb.Append("radio");
sb.Append(@" ");
sb.Append("name=");
sb.Append(@" ");
sb.Append("SYearGroup");
sb.Append(@" ");
sb.Append("id=");
sb.Append(@" ");
sb.Append("RowSelector{0}");
sb.Append(@" ");
sb.Append("value=");
sb.Append(@" ");
sb.Append("{0}");
sb.Append(@" ");
output.Text = string.Format(sb.ToString(), e.Row.RowIndex);

if (SYearGroupIndex == e.Row.RowIndex)
{
output.Text += @" checked=" + @"checked""";
output.Text += @"/>";


}


}
} 

实际网格具有以下标记:

<asp:GridView ID="gview_sy"  width="1000px"
     EmptyDataText="No Stock and year was found for the selected year." 
     DataSourceID="obj_sy" AutoGenerateColumns="false" 
     DataKeyNames="AId,s_CodeId" 
     runat="server"  AllowSorting="false" OnRowCommand="gview_sy_RowCommand" 
     OnSelectedIndexChanged="gview_sy_SelectedIndexChanged" 
     OnSorted="gview_sy_Sorted" onsorting="gview_sy_Sorting"       
     OnRowCreated="gview_sy_RowCreated">
    <Columns>
        <asp:TemplateField>
            <ItemTemplate>
                <asp:Literal ID="RadioButtonMarkup" runat="server"></asp:Literal>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:BoundField DataField="Year" ShowHeader="true"
             SortExpression="Year" HeaderText="WorkingYear" />
    </Columns>
</asp:GridView> 

<asp:button id="btnOK" runat="server" Text="OK" Width="64px"     Visible="True"
     OnClick="btnOK_Click"></asp:button>

当我在选择后按“确定”时,在我的开发笔记本电脑 (vista SP2) 和我当前的服务器 windows 2008 asp.net 3.5 上都可以正常工作。但新服务器上没有任何反应。

谁能告诉我如何找到问题?

预先非常感谢 麦克风

I have an ASP.NET web form application that now needs to be moved to a windows 2008 server.

The current version uses asp.net 3.5. On the new server(windows 2008), some javascripts do not seem to work. The controls in the page are wrapped around and updatepanel. When i press Ok, after selecting a radio button initiated on a gridview column as shown below.

private void InitCheckBoxes(GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{


Literal output = (Literal)e.Row.FindControl("RadioButtonMarkup");

StringBuilder sb = new StringBuilder();
sb.Append("<input type=");
sb.Append(@"");
sb.Append("radio");
sb.Append(@" ");
sb.Append("name=");
sb.Append(@" ");
sb.Append("SYearGroup");
sb.Append(@" ");
sb.Append("id=");
sb.Append(@" ");
sb.Append("RowSelector{0}");
sb.Append(@" ");
sb.Append("value=");
sb.Append(@" ");
sb.Append("{0}");
sb.Append(@" ");
output.Text = string.Format(sb.ToString(), e.Row.RowIndex);

if (SYearGroupIndex == e.Row.RowIndex)
{
output.Text += @" checked=" + @"checked""";
output.Text += @"/>";


}


}
} 

The actual grid has the following markup:

<asp:GridView ID="gview_sy"  width="1000px"
     EmptyDataText="No Stock and year was found for the selected year." 
     DataSourceID="obj_sy" AutoGenerateColumns="false" 
     DataKeyNames="AId,s_CodeId" 
     runat="server"  AllowSorting="false" OnRowCommand="gview_sy_RowCommand" 
     OnSelectedIndexChanged="gview_sy_SelectedIndexChanged" 
     OnSorted="gview_sy_Sorted" onsorting="gview_sy_Sorting"       
     OnRowCreated="gview_sy_RowCreated">
    <Columns>
        <asp:TemplateField>
            <ItemTemplate>
                <asp:Literal ID="RadioButtonMarkup" runat="server"></asp:Literal>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:BoundField DataField="Year" ShowHeader="true"
             SortExpression="Year" HeaderText="WorkingYear" />
    </Columns>
</asp:GridView> 

<asp:button id="btnOK" runat="server" Text="OK" Width="64px"     Visible="True"
     OnClick="btnOK_Click"></asp:button>

When I press Ok after a selection, things work both on my development laptop (vista SP2) and my current server windows 2008 asp.net 3.5. But nothing happens on the new server.

Can anyone tell how to go about finding the problem?

Many thanks in advance
Mike

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文