当我单击编辑时,我有一个包含 10 列的网格视图,它需要在另一个页面中显示数据,其中行数据处于可编辑模式以及表格的其他一些列。请帮我解决这个问题......请......,
<pre>using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
namespace WebApplication1
{
public partial class displaypage : System.Web.UI.Page
{
SqlConnection conn = new SqlConnection(@"Data Source=SRAVI-PC\SQLEXPRESS;Initial Catalog=testdb;Integrated Security=True");
protected void Page_Load(object sender, EventArgs e)
{
getdata();
}
public void getdata()
{
string cmd = "select * from namestb";
SqlDataAdapter da = new SqlDataAdapter(cmd, conn);
DataSet ds = new DataSet();
da.Fill(ds);
GridView1.DataSource = ds.Tables[0];
GridView1.DataBind();
}
protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
{
Response.Redirect("editpage.aspx");
}
}
} <code>
.aspx
<pre>
<%@ Page Language="C#" AutoEventWireup="true" EnableEventValidation="false" CodeBehind="displaypage.aspx.cs" Inherits="WebApplication1.displaypage" %>
<!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 runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:GridView ID="GridView1" runat="server">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:ImageButton ID="ImageButton1" runat="server" Height="30px"
ImageUrl="~/images/edit image.jpg" Width="38px"
onclick="ImageButton1_Click" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<br />
<br />
</div>
</form>
</body>
</html>
<code>