我想在另一个网格视图或带有可编辑模式的文本框的页面中编辑网格视图行 [英] I want to edit a grid view row in another grid view or in a page with text boxes in editable mode

查看:52
本文介绍了我想在另一个网格视图或带有可编辑模式的文本框的页面中编辑网格视图行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我点击编辑时,我有一个包含10列的网格视图,需要在另一个页面中显示数据,行数据处于可编辑模式,还有其他一些列。请帮帮我...请...,

以下是我的代码,

请给我一步一步的程序简介plz ,,,谢谢你...



I have a grid view with 10 columns when I click edit it need to display data in another page with the row data in editable mode and also some other columns of the tables. please help me out from this ...please...,
following is my code,
please give me a step by step procedure in brief plz,,, thank you..

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");
    }
}
} 










<%@ 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>

推荐答案

请参阅下面的链接。这就是你需要的另一个窗口,如弹出窗口,而不是页面。



使用GridView,DetailsView和ModalPopup控件的Master-Detail [ ^ ]
Refer to link below. That is what you need just in another window like popup,not in a page.

Master-Detail with the GridView, DetailsView and ModalPopup Controls[^]


这篇关于我想在另一个网格视图或带有可编辑模式的文本框的页面中编辑网格视图行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆