控件.Text=@"<a href=javascript:var win = window.open('static.aspx');>"+"</a>";
private void btn_Click(object sender,EventArgs e)
{
//数据处理
this.Page.RegisterStartUpScript("myJs","<script language=javascript>parent.RightFrameName.location.reload();</script>");
}
private void btn_Click(object sender,EventArgs e)
{
//数据处理
this.Page.RegisterStartUpScript("myJs","<script language=javascript>parent.RightFrameName.location.reload();</script>");
}
this.DataGrid1.Items[i].Cells[m].Text=@"<a href=javascript:var win = window.open('DataGridTotals.aspx');>"+this.DataGrid1.Items[i].Cells[m].Text+"</a>";
先谢了,第一个问题,我在一个dataGrid里填充数据完后,再在itemDataBound事件里写了如下代码(按你的说法):this.DataGrid1.Items[i].Cells[m].Text=@"<a href=javascript:var win = window.open('DataGridTotals.aspx');>"+this.DataGrid1.Items[i].Cells[m].Text+"</a>";可是运行起来会出错,认不到a href这个标识。
第二个问题:我是有左右两个框架,按左框架(a.aspx)的链接值传一参数到右框架(b.aspx),然后再在b.aspx上按一按钮弹出对框(window.open('c.aspx')),处理完数据后,在c.aspx上有一个完成的按钮,我想当用户按这个按钮时关闭c.aspx,同时刷新框架的框架b.aspx我试了很多方法都不能刷新?
还是不行唉?为什么呢?
{
//数据处理
this.Page.RegisterStartUpScript("myJs","<script language=javascript>opener.location.reload();window.close();</script>");
}
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
GHMaintain.common conn=new GHMaintain.common();
System.Text.StringBuilder selectStr = new System.Text.StringBuilder("");
selectStr.Append("select * from abtn_info");
DataSet selectSet=conn.selFromDataBase(selectStr.ToString());
//将数据绑定到指定的下拉框中
DataGrid1.DataSource=selectSet.Tables[0].DefaultView;
//以下代码为调用分页控件的类,这样就可以实现DataGrid的分页功能
ahui setDataGrid = new ahui();
setDataGrid.DataGridStyle(DataGrid1);
DataGrid1.DataBind();
} #region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN:该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.DataGrid1.ItemDataBound += new System.Web.UI.WebControls.DataGridItemEventHandler(this.DataGrid1_ItemDataBound);
this.Load += new System.EventHandler(this.Page_Load); }
#endregion private void DataGrid1_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
//为指定的行加一个单击时间,并传递一些参数进入相应的事件
for(int i=0;i<this.DataGrid1.Items.Count;i++)
{
if(i==1)
{
for(int m=0;m<this.DataGrid1.Items[i].Cells.Count;m++)
{
this.DataGrid1.Items[i].Cells[m].Text=@"<a href=javascript:var win = window.open('DataGridTotals.aspx');>"+this.DataGrid1.Items[i].Cells[m].Text+"</a>";
}
}
}
}
第二个问题:我也不知是不是权限的问题