解决方案 »
- 由于代码已经过优化或者本机框架位于调用堆栈之上,无法计算表达式的值。
- 如何用正则替换img的SRC值
- 一个简单的JS传参,在线等。3分钟内结贴
- 怎么样用.net做ftp工具可以指定文件加可以直接上传文件
- 大家好,我的环境又出问题了!!···
- 关于数据缓存
- 刚把2.0的CMS整理了一下,发出来了,有用的去下载吧,内置了一套图片站的模板
- 如果DATAGRID绑定后台数据库后, 它的列的宽度是不是肯定不能设定的?我要指定宽度.请问怎样解决这个问题,
- 讨论:该代码产生的字符串在多大访问量内不会重复?
- 怎样指定一个动态增加按钮的事件(vb.net)
- sql 查询
- 求助,我电脑 突然访问其他如何服务器的webservice的方法都失败了...
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "del")
{
ppm.DeletePaper(Convert.ToInt32(e.CommandArgument.ToString()));
this.GridView1.DataSource = ppm.GetPapers();
this.GridView1.DataBind();
}
//GridView设置
<asp:GridView ID="gvAdmin" runat="server" CellPadding="4" ForeColor="#333333" GridLines="None" AutoGenerateColumns="False" Font-Size="9pt" Width="500px" AllowPaging="True" OnPageIndexChanging="GridView1_PageIndexChanging" OnRowDeleting="GridView1_RowDeleting" Font-Bold="False" OnRowDataBound="gvAdmin_RowDataBound">
<FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
<Columns>
<asp:BoundField HeaderText="管理员ID" DataField="ID" />
<asp:BoundField HeaderText="用户名" DataField="UserName" />
<asp:BoundField HeaderText="管理员性别" DataField="Sex" />
<asp:BoundField HeaderText="QQ" DataField="QQ" />
<asp:BoundField HeaderText="注册时间" DataField="RegTime" />
<asp:HyperLinkField DataNavigateUrlFields="ID" DataNavigateUrlFormatString="AdminInfo.aspx?ID={0}"
HeaderText="修改信息" Text="修改信息" />
</Columns>//codego.net/tags/11/1/
<SelectedRowStyle BackColor="#C5BBAF" ForeColor="#333333" Font-Bold="True" />
<PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" />
<HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="White" />
<RowStyle BackColor="#E3EAEB" />
<EditRowStyle BackColor="#7C6F57" />
</asp:GridView>
//根据ID号跳转修改页面显示该行修改信息
<asp:TextBox ID="txtName" runat="server" BackColor="White" Width="115px"></asp:TextBox>//管理员名称
<asp:TextBox ID="txtPwd" runat="server" BackColor="#E0E0E0" ReadOnly="True" Width="117px"></asp:TextBox>//显示密码
<asp:TextBox ID="txtOKpwd" runat="server" Width="117px"></asp:TextBox>//修改密码
<asp:DropDownList ID="ddlSex" runat="server">
<asp:ListItem>男</asp:ListItem>
<asp:ListItem>女</asp:ListItem>
</asp:DropDownList>//显示性别设置
<asp:TextBox ID="txtRealName" runat="server" Width="117px"></asp:TextBox>//显示真实姓名
<asp:TextBox ID="txtBirthday" runat="server" Width="117px"></asp:TextBox>//显示生日
员:<asp:DropDownList ID="DropDownList1" runat="server" Height="17px" Width="45px">
<asp:ListItem Value="True">是</asp:ListItem>
<asp:ListItem Value="False">否</asp:ListItem>
</asp:DropDownList>//修改是否超级管理员
<asp:Button ID="btnUpdate" runat="server" Font-Size="9pt" Text="修改" OnClick="btnUpdate_Click" />//修改事件按钮
//cs页面加载显示修改信息内容
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
try
{
SqlConnection mycon = new SqlConnection(ConfigurationManager.AppSettings["conStr"]);
mycon.Open();
DataSet mydataset = new DataSet();
SqlDataAdapter mydataadapter = new SqlDataAdapter("select * from tb_Admin where id=" + Request["id"],mycon);
mydataadapter.Fill(mydataset, "tb_Admin");
DataRowView rowview = mydataset.Tables["tb_Admin"].DefaultView[0];
this.txtName.Text = Convert.ToString(rowview["UserName"]);
this.txtPwd.Text = Convert.ToString(rowview["PassWord"]);
this.ddlSex.SelectedValue = Convert.ToString(rowview["Sex"]);
this.txtRealName.Text = Convert.ToString(rowview["ReallyName"]); this.DropDownList1.SelectedValue = Convert.ToString(rowview["SuperAdmin"]);
this.txtIP.Text = Convert.ToString(rowview["IP"]);
mycon.Close();
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
}
}
//修改行信息数据
protected void btnUpdate_Click(object sender, EventArgs e)
{
try
{
SqlData da = new SqlData();
string P_str_Com = "update tb_Admin set UserName='" + this.txtName.Text + "',PassWord='" + this.txtOKpwd.Text + "'"
+ ",Sex='" + this.ddlSex.SelectedValue + "',ReallyName='" + this.txtRealName.Text + "',SuperAdmin='" + this.DropDownList1.SelectedValue + "'"
+ " where ID='" + Request["ID"] + "'";
bool add = da.ExceSQL(P_str_Com);
if (add == true)
{
Response.Write("<script language=javascript>alert('修改信息成功!');location='AdminManage.aspx'</script>");
}
else
{
Response.Write("<script language=javascript>alert('修改信息失败!');location='javascript:history.go(-1)'</script>");
}
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
}