62,046
社区成员
发帖
与我相关
我的任务
分享
<%@ Control Language="C#" AutoEventWireup="true" Inherits="UserPratice" Codebehind="UserPratice.ascx.cs" %>
<table width="820px" align="left"
cellpadding="0" cellspacing="0"><tr><td align="center">
<asp:Label ID="lbTitle" runat="server"></asp:Label>
<asp:Label ID="lbPracticeId" runat="server" Visible="False"></asp:Label>
</td></tr>
<tr><td>
<asp:Panel ID="PlaceHolder1" Width="820px" runat="server"></asp:Panel>
</td></tr>
<tr><td><asp:GridView ID="GV_Grade" runat="server" CellPadding="4"
ForeColor="#333333" GridLines="None" Width="100%"
EmptyDataText="抱歉,暂无数据。">
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<RowStyle BackColor="#EFF3FB" HorizontalAlign="Center" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<EditRowStyle BackColor="#2461BF" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>
</td></tr>
</table>
public partial class UserPratice : System.Web.UI.UserControl
{
CPracticePater paper = new CPracticePater();
string practiceid = "";
string practicePaperId = "";
protected void Page_Init(object sender, EventArgs e)
{
…………………………………………
}
public void CreatePractice( …………)
{
this.practicePaperId = ………………;
}
}
public partial class UserPratice : System.Web.UI.UserControl
{
CPracticePater paper = new CPracticePater();
string practiceid= "";
protected void Page_Init(object sender, EventArgs e)
{
…………………………………………
if(!ispostback)
string practicePaperId = "";
}
public void CreatePractice( …………)
{
this.practicePaperId = ………………;
}
}
<body>
<form id="form1" runat="server">
<table width="800" height="25" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td>您的位置:<a href="CourseStudyRight.aspx">首页</a>>><a href="SPracticeList.aspx">在线练习</a>>>完成练习</td>
<td align="center">
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
<asp:Timer ID="Timer1" runat="server" OnTick="Timer1_Tick" Interval="1000"></asp:Timer>
</ContentTemplate>
</asp:UpdatePanel>
</td>
</tr>
</table>
<table width="800" align="center">
<tr>
<td>
<asp:Panel ID="Panel2" runat="server">
<uc1:UserPratice ID="UserPratice1" runat="server" />
</asp:Panel>
</td>
</tr>
<tr>
<td align="center">
<asp:Button ID="btnTiJiaoAll"
OnClientClick="return Checksubmit();" runat="server" Text="全部提交"
OnClick="btnTiJiaoAll_Click" CssClass="inputbuton" />
</td>
</tr>
</table>
</form>
</body>
只在这一处地方 用到了这个控件<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="StudentPractice.aspx.cs" Inherits="Webs.StudentPractice" %>
<%@ Register Src="App_Controls/UserPratice.ascx" TagName="UserPratice" TagPrefix="uc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>教学互进管理系统</title>
<link href="../css/css.css" rel="stylesheet" type="text/css" />
<script type="text/JavaScript" src="../JS/frame.js"></script>
</head>
<body>
<form id="form1" runat="server">
<table width="800" height="25" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td>您的位置:<a href="CourseStudyRight.aspx">首页</a>>><a href="SPracticeList.aspx">在线练习</a>>>完成练习</td>
<td align="center">
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
<asp:Timer ID="Timer1" runat="server" OnTick="Timer1_Tick" Interval="10000"></asp:Timer>
</ContentTemplate>
</asp:UpdatePanel>
</td>
</tr>
</table>
<table width="800" align="center">
<tr>
<td>
<asp:Panel ID="Panel2" runat="server">
<uc1:UserPratice ID="UserPratice1" runat="server" />
</asp:Panel>
</td>
</tr>
<tr>
<td align="center">
<asp:Button ID="btnTiJiaoAll"
OnClientClick="return Checksubmit();" runat="server" Text="全部提交"
OnClick="btnTiJiaoAll_Click" CssClass="inputbuton" />
</td>
</tr>
</table>
</form>
</body>
</html>
单步执行几次后 跳转到了这个aspx页面里 我发现了问题 这个aspx里有个timer1控件用来显示时分秒考试倒计时
当interval间隔为1秒的时候 timer1_tick和string practicePaperId = "";这个初始化是同步进行的 为了证明这一点 我把interval设为10秒 发现确实如此 是UserParctice.ascx随着timer控件一起刷新了吗 但是为什么呢 我并没有把UserPartice放到UpdatePanel里面去呀public partial class UserPratice : System.Web.UI.UserControl
{
CPracticePater paper = new CPracticePater();
string practiceid = "";
string practicePaperId = "";
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
tystk.Models.CUser cUser = (tystk.Models.CUser)Session["LoginUsr"];
if (cUser != null)
{
if (Request.Params["practiceId"] == null)
{
Response.Write("<script>alert('抱歉,读取试卷出错!');location.reload('SPracticeList.aspx');</script>");
return;
}
this.practiceid = Request.Params["practiceId"].ToString();
this.CreatePractice(cUser); //调用CreatPractice
}
else
{
ErrorLog("登陆超时!");
Response.Redirect("../LetMeIn.aspx");
}
}
}
public void CreatePractice( )
{
this.practicePaperId = ………………;
}
public void CheckPratice( )
{
............ = this.practicePaperId;
}
}
这是详细 而且我现在发现 string practicePaperId = ""; 是一直不断地在初始化 当我进入首页 首页总不包含这个控件 我也没有进行任何操作 但是这条语句不停地在执行 设为断点以后 按一下F5马上就跳回到这条语句