DataGrid高手:这种Grid如何实现? 我也想要一份能发给我吗,谢谢;[email protected] 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 //前台按钮列<asp:ButtonColumn CommandName=事件 Text=aaa></asp:ButtonColumn>后台private void dgItem_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) { if(e.CommandName=="时间") { this.Response.Write("<script language=javascript>window.open......... </script>"); } } 我给你思路吧,原代码在家里!要明天在说 在页面输出xml 然后,动态好像查询数据库一样,把相关的数据找出来,放到一个动态生成的iframe中 TO:acewang(**^o^**) ( ) 能给我一份吗?[email protected]谢谢 to acewang(**^o^**) :[email protected]可否发一份!!谢谢 有一个思想:定义这个按钮运行一个客户端的一个javascript的程序,取得这个按钮在屏幕的像素值,然后在这个位置打开一个新帧,帧中的内容就自己定了 能给我一个吗?[email protected] 能给我一个马?[email protected] 能给我一个吗?[email protected] 能给我一个吗?[email protected] 能给我一个吗?[email protected] <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><%@import namespace="System.Data"%><%@import namespace="System.Data.OleDb"%><html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><title>利用模板增加</title></head><script language="C#" runat="server">void bingding(){ string connstr="Provider=MicroSoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("renshi.mdb"); OleDbDataAdapter ada=new OleDbDataAdapter("select * from bm",connstr); DataSet ds=new DataSet(); ada.Fill(ds,"bm"); datagrid1.DataSource=ds.Tables[0].DefaultView; datagrid1.DataBind();} void Page_Load(Object sender,EventArgs e){ if(!IsPostBack) { bingding(); }}void datagrid1_edit(Object sender,DataGridCommandEventArgs e){datagrid1.ShowFooter=false;datagrid1.EditItemIndex=e.Item.ItemIndex;bingding();}void datagrid1_cancel(Object sender,DataGridCommandEventArgs e){datagrid1.ShowFooter=true;datagrid1.EditItemIndex=-1;bingding();}void datagrid1_update(Object sender,DataGridCommandEventArgs e){string s_bmid=((Label)e.Item.FindControl("bmid")).Text;string s_bmmc=((TextBox)e.Item.FindControl("bmmc")).Text;string connstr="Provider=MicroSoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("renshi.mdb");OleDbConnection conn=new OleDbConnection(connstr);string sqlstr="update bm set bmmc='"+s_bmmc+"' where bmid='"+s_bmid+"'";OleDbCommand cmd=new OleDbCommand(sqlstr,conn);conn.Open();cmd.ExecuteNonQuery();conn.Close();datagrid1.ShowFooter=true;datagrid1.EditItemIndex=-1;bingding();}void addnew(Object sender,DataGridCommandEventArgs e){if(e.CommandName=="insert"){ string s_id=((TextBox)e.Item.FindControl("addbmid")).Text; string s_mc=((TextBox)e.Item.FindControl("addbmmc")).Text; string connstr="Provider=MicroSoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("renshi.mdb"); OleDbConnection conn=new OleDbConnection(connstr); string sqlstr="insert into bm values('"+s_id+"','"+s_mc+"')"; OleDbCommand cmd=new OleDbCommand(sqlstr,conn); conn.Open(); cmd.ExecuteNonQuery(); conn.Close();}if(e.CommandName=="delete"){}datagrid1.EditItemIndex=-1;bingding();}</script><body><form runat="server"><table width="100%" border="1"><tr><td width="25%"></td><td width="75%"><asp:datagrid ID="datagrid1" runat="server" HeaderStyle-BackColor="#3399FF" Width="100%" Font-Size="10pt" OnItemCommand="addnew" ShowFooter="true" AutoGenerateColumns="false" OnCancelCommand="datagrid1_cancel" OnEditCommand="datagrid1_edit" OnUpdateCommand="datagrid1_update"> <columns> <asp:templatecolumn HeaderText="部门编号" HeaderStyle-Width="25%"> <footertemplate> <asp:textbox ID="addbmid" Columns="10" runat="server"/> </footertemplate> <itemtemplate> <%#DataBinder.Eval(Container.DataItem,"bmid")%> </itemtemplate> <edititemtemplate> <asp:label ID="bmid" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"bmid")%>'/> </edititemtemplate> </asp:templatecolumn> <asp:templatecolumn HeaderText="部门名称" HeaderStyle-Width="30%"> <footertemplate> <asp:textbox ID="addbmmc" Columns="10" runat="server"/> </footertemplate> <itemtemplate> <%#DataBinder.Eval(Container.DataItem,"bmmc")%> </itemtemplate> <edititemtemplate> <asp:textbox ID="bmmc" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"bmmc")%>'/> </edititemtemplate> </asp:templatecolumn> <asp:EditCommandColumn UpdateText="Update" CancelText="Cancel" EditText="Edit" HeaderText="Edit"> </asp:EditCommandColumn> <asp:templatecolumn HeaderText="增加/删除" HeaderStyle-Width="20%"> <footertemplate> <asp:button ID="button1" Text="增加" runat="server" CommandName="insert"/> </footertemplate> <itemtemplate> <asp:linkbutton ID="button2" Text="删除" runat="server" CommandName="delete"/> </itemtemplate> </asp:templatecolumn> </columns> </asp:datagrid> <br> <asp:textbox ID="textbox1" runat="server" size=10/></td></tr></table></form></body></html> 楼主:acewang(**^o^**) (已发给你了不妨贴也来大家学习学习! http://msdn.microsoft.com/msdnmag/issues/03/10/CuttingEdge/default.aspx 能给我一个吗?[email protected]谢谢 acewang(**^o^**) 你好,谢谢你,发给我一份好吗 [email protected]◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆◆◆◆ ◆ ◆ ◆◆◆◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆◆ ◆◆◆◆◆◆◆◆ ◆◆ ◆◆◆◆◆◆◆◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆◆◆◆◆ ◆ ◆ ◆◆◆◆◆ ◆ ◆ ◆ ◆ ◆◆ ◆ ◆ ◆ ◆◆ ◆ ◆◆◆◆ ◆ ◆ ◆◆◆◆ ◆ ◆◆ ◆ ◆ ◆ ◆◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆◆ ◆◆ ◆ ◆◆ ◆◆ 关于textbox属性text赋值问题? 怎么在页面得到参数并且直接显示出来 DataSet怎么为某一列赋值 请教一个关于依赖注入的问题 看看怎么设计好点啊!在线等 使用freetextbox遇到不能获得焦点,无法取出text值(js)的问题. 请教:如何获取web.config中的globalization配置信息 关于用.net移动控件开发wap的问题!急 图片在规定时间内会改变的问题 请教:如何在页面关闭时消除Cache变量?? asp.net里面有没有将一些不同控件归类的控件?? dataGrid中使用Dropdownlist出现的问题
<asp:ButtonColumn CommandName=事件 Text=aaa></asp:ButtonColumn>
后台
private void dgItem_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
if(e.CommandName=="时间")
{
this.Response.Write("<script language=javascript>window.open......... </script>");
}
}
在页面输出xml
然后,动态好像查询数据库一样,把相关的数据找出来,放到一个动态生成的iframe中
能给我一份吗?[email protected]
谢谢
[email protected]可否发一份!!谢谢
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
<%@import namespace="System.Data"%>
<%@import namespace="System.Data.OleDb"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>利用模板增加</title>
</head>
<script language="C#" runat="server">
void bingding()
{
string connstr="Provider=MicroSoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("renshi.mdb");
OleDbDataAdapter ada=new OleDbDataAdapter("select * from bm",connstr);
DataSet ds=new DataSet();
ada.Fill(ds,"bm");
datagrid1.DataSource=ds.Tables[0].DefaultView;
datagrid1.DataBind();
}
void Page_Load(Object sender,EventArgs e)
{
if(!IsPostBack)
{
bingding();
}
}
void datagrid1_edit(Object sender,DataGridCommandEventArgs e){
datagrid1.ShowFooter=false;
datagrid1.EditItemIndex=e.Item.ItemIndex;
bingding();
}
void datagrid1_cancel(Object sender,DataGridCommandEventArgs e){
datagrid1.ShowFooter=true;
datagrid1.EditItemIndex=-1;
bingding();
}
void datagrid1_update(Object sender,DataGridCommandEventArgs e){
string s_bmid=((Label)e.Item.FindControl("bmid")).Text;
string s_bmmc=((TextBox)e.Item.FindControl("bmmc")).Text;
string connstr="Provider=MicroSoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("renshi.mdb");
OleDbConnection conn=new OleDbConnection(connstr);
string sqlstr="update bm set bmmc='"+s_bmmc+"' where bmid='"+s_bmid+"'";
OleDbCommand cmd=new OleDbCommand(sqlstr,conn);
conn.Open();
cmd.ExecuteNonQuery();
conn.Close();
datagrid1.ShowFooter=true;
datagrid1.EditItemIndex=-1;
bingding();
}
void addnew(Object sender,DataGridCommandEventArgs e){
if(e.CommandName=="insert")
{
string s_id=((TextBox)e.Item.FindControl("addbmid")).Text;
string s_mc=((TextBox)e.Item.FindControl("addbmmc")).Text;
string connstr="Provider=MicroSoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("renshi.mdb");
OleDbConnection conn=new OleDbConnection(connstr);
string sqlstr="insert into bm values('"+s_id+"','"+s_mc+"')";
OleDbCommand cmd=new OleDbCommand(sqlstr,conn);
conn.Open();
cmd.ExecuteNonQuery();
conn.Close();
}
if(e.CommandName=="delete")
{}
datagrid1.EditItemIndex=-1;
bingding();
}
</script>
<body>
<form runat="server">
<table width="100%" border="1">
<tr>
<td width="25%"></td>
<td width="75%">
<asp:datagrid ID="datagrid1" runat="server" HeaderStyle-BackColor="#3399FF" Width="100%"
Font-Size="10pt" OnItemCommand="addnew" ShowFooter="true" AutoGenerateColumns="false"
OnCancelCommand="datagrid1_cancel" OnEditCommand="datagrid1_edit"
OnUpdateCommand="datagrid1_update">
<columns>
<asp:templatecolumn HeaderText="部门编号" HeaderStyle-Width="25%">
<footertemplate>
<asp:textbox ID="addbmid" Columns="10" runat="server"/>
</footertemplate>
<itemtemplate>
<%#DataBinder.Eval(Container.DataItem,"bmid")%>
</itemtemplate>
<edititemtemplate>
<asp:label ID="bmid" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"bmid")%>'/>
</edititemtemplate>
</asp:templatecolumn>
<asp:templatecolumn HeaderText="部门名称" HeaderStyle-Width="30%">
<footertemplate>
<asp:textbox ID="addbmmc" Columns="10" runat="server"/>
</footertemplate>
<itemtemplate>
<%#DataBinder.Eval(Container.DataItem,"bmmc")%>
</itemtemplate>
<edititemtemplate>
<asp:textbox ID="bmmc" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"bmmc")%>'/>
</edititemtemplate>
</asp:templatecolumn>
<asp:EditCommandColumn
UpdateText="Update" CancelText="Cancel"
EditText="Edit" HeaderText="Edit">
</asp:EditCommandColumn>
<asp:templatecolumn HeaderText="增加/删除" HeaderStyle-Width="20%">
<footertemplate>
<asp:button ID="button1" Text="增加" runat="server" CommandName="insert"/>
</footertemplate>
<itemtemplate>
<asp:linkbutton ID="button2" Text="删除" runat="server" CommandName="delete"/>
</itemtemplate>
</asp:templatecolumn>
</columns>
</asp:datagrid>
<br>
<asp:textbox ID="textbox1" runat="server" size=10/>
</td>
</tr>
</table>
</form>
</body>
</html>
[email protected]
谢谢
◆ ◆◆◆◆ ◆ ◆ ◆◆◆◆ ◆
◆ ◆ ◆ ◆ ◆ ◆
◆◆ ◆◆◆◆◆◆◆◆ ◆◆ ◆◆◆◆◆◆◆◆
◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆
◆ ◆◆◆◆◆ ◆ ◆ ◆◆◆◆◆ ◆
◆ ◆ ◆ ◆◆ ◆ ◆ ◆ ◆◆
◆ ◆◆◆◆ ◆ ◆ ◆◆◆◆ ◆
◆◆ ◆ ◆ ◆ ◆◆ ◆ ◆ ◆
◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆
◆ ◆◆ ◆◆ ◆ ◆◆ ◆◆