新手学习中遇到的一个问题,烦请各位帮帮忙,先谢啦~
*************************************************
A 页面的中我定义了一个GridView (已经RowDataBound)  使用了
<asp:HyperLinkField DataNavigateUrlFields="CompanyID" HeaderText="编辑" Text="编辑" DataNavigateUrlFormatString="ComInfWeb-Editor.aspx?comm={0} "Visible="true" />如何向B 页面的各个TextBox传值?
*************************************************
A 页面已经写的方法 如下
namespace CompanyInfor
{
    public partial class ComInfWeb : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            int id = 0;            if (!IsPostBack)
            {
                if (Request.QueryString["com"] != null)
                {
                    id = int.Parse(Request.QueryString["com"].ToString());                    ComInformation delIdInf = new ComInformation();                    CompanyInformationAccess delIdInfAcc = new CompanyInformationAccess();                    delIdInf.CompanyID = id;                    bool getdel = delIdInfAcc.del(delIdInf.CompanyID);
                    GridViewTest();
                }
                //if (Request.QueryString["com"] != null)
                //{
                //    id = int.Parse(Request.QueryString["com"].ToString());                //    ComInformation selIdInf = new ComInformation();                //    CompanyInformationAccess selIdInfAcc = new             CompanyInformationAccess();                //    selIdInf.CompanyID = id;                //    DataTable getdel = selIdInfAcc.sel(selIdInf.CompanyID);
                //}
            }
        }        /// <summary>
        /// 添加信息 绑定GridView 并清空TextBox
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnYes_Click(object sender, EventArgs e)
        {
            ComInformation addInf = new ComInformation();
            CompanyInformationAccess addInfAcc = new CompanyInformationAccess();            int addID = int.Parse(Request.Form["txtID"]);
            string addName = Request.Form["txtName"];
            string addPerson = Request.Form["txtJuridicalPerson"];
            string addAddress = Request.Form["txtAddress"];
            string addTel = Request.Form["txtTel"];
            DateTime addTime = DateTime.Parse(Request.Form["txtRgeistrationTime"]);
            int addMoney = int.Parse(Request.Form["txtMoney"]);
            string addScope = Request.Form["txtBusinessScope"];
            int addNumbers = Convert.ToInt32(Request.Form["txtEmployNumber"]);
            addInf.CompanyID = addID;
            addInf.CompanyName = addName;
            addInf.CompanyJuridicalPerson = addPerson;
            addInf.CompanyAddress = addAddress;
            addInf.CompanyTel = addTel;
            addInf.RgeistrationTime = addTime;
            addInf.RgeistrationMoney = addMoney;
            addInf.BusinessScope = addScope;
            addInf.EmployNumber = addNumbers;            bool getAdd = addInfAcc.AddComInf(addInf);
            
            GridViewTest();            txtID.Text = "";
            txtName.Text = "";
            txtJuridicalPerson.Text = "";
            txtAddress.Text = "";
            txtTel.Text = "";
            txtRgeistrationTime.Text = "";
            txtMoney.Text = "";
            txtBusinessScope.Text = "";
            txtEmployNumber.Text = "";        }        /// <summary>
        /// 清除信息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnNo_Click(object sender, EventArgs e)
        {
            txtID.Text = "";
            txtName.Text = "";
            txtJuridicalPerson.Text = "";
            txtAddress.Text = "";
            txtTel.Text = "";
            txtRgeistrationTime.Text = "";
            txtMoney.Text = "";
            txtBusinessScope.Text = "";
            txtEmployNumber.Text = "";            GridViewTest();
        }        /// <summary>
        /// 通过ID删除 并绑定GridView
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Button1_Click(object sender, EventArgs e)
        {
            ComInformation delIdInf = new ComInformation();
            CompanyInformationAccess delIdInfAcc = new CompanyInformationAccess();            int delID = int.Parse(Request.Form["txtID"]);
            delIdInf.CompanyID = delID;
            bool getdel = delIdInfAcc.del(delIdInf.CompanyID);            GridViewTest();        }        /// <summary>
        /// 绑定GridView
        /// </summary>
        private void GridViewTest()
        {
            ComInformation appnew = new ComInformation();
            CompanyInformationAccess Anew = new CompanyInformationAccess();
            DataTable dr = new DataTable();
            dr = Anew.SelComInf();            gdvTest.DataSource = dr;  //获得数据源
            gdvTest.DataBind();       //绑定数据            
        }        /// <summary>
        /// GridView RowDataBound
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void gdvTest_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                e.Row.Cells[6].Text = "******";                string companyid = e.Row.Cells[0].Text;
                int comId = int.Parse(companyid);
                if (comId % 2 == 0)
                {
                    e.Row.Attributes.Add("style", "background-color:#CAE1FF;");
                }
            }
        }
    }
}*****************************************************
B 页面

解决方案 »

  1.   

    这个一般两种方式处理,后台cs处理和前台js1.后台cs:
    根据内容直接生成标签的数据
    相关事件:RowDataBound(- - 应该是这个,没用过gdv)2.前台Js
    获取相应的行内数据,循环生成A标签。
      

  2.   

    刚才自己试了一中解决方案 
    代码如下:
    *************************************
    B 页面代码(.aspx.cs)
    namespace CompanyInfor
    {
        public partial class ComInfWeb_Editor : System.Web.UI.Page
        {
            protected void Page_Load(object sender, EventArgs e)
            {            if (!IsPostBack)
                {
                    if (Request.QueryString["comm"] != null)
                    {
                        int id = int.Parse(Request.QueryString["comm"].ToString());                    ComInformation selIdInf = new ComInformation();                    CompanyInformationAccess selIdInfAcc = new CompanyInformationAccess();                    selIdInf.CompanyID = id;                    DataTable getsel = selIdInfAcc.sel(selIdInf.CompanyID);                    txtID.Text = getsel.Rows[0]["CompanyID"].ToString();
                        txtID.Attributes.Add("readonly", "true");
                        txtName.Text = getsel.Rows[0]["CompanyName"].ToString();
                        txtJuridicalPerson.Text = getsel.Rows[0]["CompanyJuridicalPerson"].ToString();
                        txtAddress.Text = getsel.Rows[0]["CompanyAddress"].ToString();
                        txtTel.Text = getsel.Rows[0]["CompanyTel"].ToString();
                        txtRgeistrationTime.Text = getsel.Rows[0]["RgeistrationTime"].ToString();
                        txtMoney.Text = getsel.Rows[0]["RgeistrationMoney"].ToString();
                        txtBusinessScope.Text = getsel.Rows[0]["BusinessScope"].ToString();
                        txtEmployNumber.Text = getsel.Rows[0]["EmployNumber"].ToString();                }
                }
            }
        }
    }
      

  3.   

    好长的代码。推荐看看这篇文章
    ASP.NET页面间传值的几种方式
    http://blog.csdn.net/microsoftcenterofhn/article/details/4170404
      

  4.   

    你选中一行然后获取他的id,把id给到b页面,然后b页面通过id查询绑定文本框即可