来人救命了~~~~~~~~
public void SelectDataGrid(int i)
{
if(i==1)
{
this.dgCreatePlan.Enabled=false;
}
else if(i==2)
{
this.dgCreatePlan.Enabled=true;
}
}
private void DataGridBind(System.Web.UI.WebControls.DataGrid dg,string strCom)
{
try
{
WebControlMethod.DataGridBind(dg,strCom);
}
catch(Exception ex)
{
lbMsg.Text= "错误: "+ex.Message;
}
}
public void CreatedUncplePlan()
{
SelectDataGrid(2);
this.lbPlanListType.Text= "我的项目> > 未完成项目 ";
this.lbUncplPlan.Text= " <a href= '# ' class= 'operate '> 未完成项目 </a> ";
this.lbCpledPlan.Text= " <a href= 'PlanController.aspx?action=createCpledPlan ' class= 'operate '> 已完成项目 </a> ";
this.lbAddPlan.Text= " <img src= '../../WebPic/func_new.gif '> <a href= 'AddPlan.aspx ' class= 'operate '> 新建项目 </a> ";
string strSel= "exec P_GetPlanList ' "+this.EmpId+ " ', 'createdUncplPlan ' ";
this.DataGridBind(this.dgCreatePlan,strSel);
}
分页有时候好使,有时候就没反应,没反映时在页面左下角会出现小叹号,提示页面有错误,请指点迷津~~~
<asp:datagrid id= "dgCreatePlan " runat= "server " AutoGenerateColumns= "False " DataKeyField= "mes_id " Width= "800px " AllowPaging=True PageSize= "10 " PagerStyle-Mode=NumericPages>
<HeaderStyle CssClass= "headerStyle " ForeColor= "White " HorizontalAlign= "Center " />
<ItemStyle BackColor= "white " />
<AlternatingItemStyle BackColor= "#EEEEEE " />
<PagerStyle Mode=NumericPages HorizontalAlign=Right Position=TopAndBottom> </PagerStyle>
<Columns>
<asp:BoundColumn HeaderText= "编号 " DataField= "mes_id "> </asp:BoundColumn>
<asp:TemplateColumn ItemStyle-Width= "300 " HeaderText= "标题 ">
<ItemTemplate>
<a style= "cursor:hand; " onmouseout= "hiddenDiv() " onmouseover= "javascript:startRequest( ' <%# DataBinder.Eval(Container.DataItem, "mes_id ")%> ', 'createdUncplPlan ') " onclick= "javascript:viewPlan( ' <%# DataBinder.Eval(Container.DataItem, "mes_id ")%> ', 'createdUncplPlan ') ">
<%# DataBinder.Eval(Container.DataItem, "title ")%>
</a>
</ItemTemplate>
</asp:TemplateColumn>
<asp:BoundColumn ItemStyle-Width= "70 " HeaderText= "紧急程度 " DataField= "secretName " />
<asp:BoundColumn ItemStyle-Width= "70 " HeaderText= "重要程度 " DataField= "urgentName " />
<asp:BoundColumn ItemStyle-Width= "130 " HeaderText= "立项时间 " DataField= "add_date " />
<asp:BoundColumn ItemStyle-Width= "130 " HeaderText= "计划完成时间 " DataField= "over_date " />
</Columns>
</asp:datagrid>
后台代码
public void CreatedCpledPlan()
{
SelectDataGrid(2);
this.lbPlanListType.Text= "我的项目> > 已完成项目 ";
this.lbUncplPlan.Text= " <a href= 'PlanController.aspx?action=createdUncplPlan ' class= 'operate '> 未完成项目 </a> ";
this.lbCpledPlan.Text= " <a href= '# ' class= 'operate '> 已完成项目 </a> ";
string strSel= "exec P_GetPlanList ' "+this.EmpId+ " ', 'createCpledPlan ' ";
this.lbAddPlan.Text= " <img src= '../../WebPic/func_new.gif '> <a href= 'AddPlan.aspx ' class= 'operate '> 新建项目 </a> ";
this.DataGridBind(this.dgCreatePlan,strSel);
}
private void Page_Load(object sender, System.EventArgs e)
{
string strAction=Request.QueryString[ "action "];
if(!IsPostBack)
{
switch(strAction)
{
case "createdUncplPlan ":
CreatedUncplePlan();
break;
case "createCpledPlan ":
CreatedCpledPlan();
break;
}
}
}
private void dgCreatePlan_SelectedIndexChanged_1(object sender, System.EventArgs e)
{
string strAction=Request.QueryString[ "action "];
switch(strAction)
{
case "createdUncplPlan ":
CreatedUncplePlan();
break;
case "createCpledPlan ":
CreatedCpledPlan();
break;
}
}
private void dgCreatePlan_PageIndexChanged(object source, System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
{
string strAction=Request.QueryString[ "action "];
switch(strAction)
{
case "createdUncplPlan ":
this.dgCreatePlan.CurrentPageIndex=e.NewPageIndex;
this.dgCreatePlan.DataBind();
CreatedUncplePlan();
break;
case "createCpledPlan ":
this.dgCreatePlan.CurrentPageIndex=e.NewPageIndex;
this.dgCreatePlan.DataBind();
CreatedCpledPlan();
break;
}
}
}
}
[解决办法]
关于datagrid的分页,可以参考
http://www.cnblogs.com/weekzero/archive/2005/08/09/210674.html
[解决办法]
有时候不好的话,怀疑是数据中有不符合js处理的,重点看看翻页到不行的那页中的所有的数据,分析一下
[解决办法]
问题应该出在你的javascript函数里,eventtarget:可能是函数里定义了这个(好像是打开新页面的Target,比如Target= "Blank "),但没赋值
[解决办法]
脚本错误,分页时脚本的值丢失