Wrox Programmer Forums
|
ASP.NET 1.1 As of 10/6/2005, this forum is locked as part of the reorganization described here: http://p2p.wrox.com/topic.asp?TOPIC_ID=35394. No posts have been deleted. Open ongoing discussions from the last week have been moved to either ASP.NET 1.0 and 1.1 Beginners http://p2p.wrox.com/asp-net-1-0-1-1-basics-60/ or ASP.NET 1.0 and 1.1 Professional. http://p2p.wrox.com/forum.asp?FORUM_ID=50. See my sticky post inside for more.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.1 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 6th, 2005, 01:59 AM
Registered User
 
Join Date: Jul 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default datagrid with chek boxes

hi i am having two pages having datagrid.

so, i want to select some rows in select.aspx and click on button then selected rows are automatically dispalyed in the displayitems.aspx in datagrid.
here my coding not gives the proper result.

select.aspx:-
-----------------

private void Button1_Click(object sender, System.EventArgs e)
        {
            DataTable dt=new DataTable();
            DataRow dr;
            dt.Columns.Add("productid");
dt.Columns.Add("productname");

            foreach (DataGridItem item in DataGrid1.Items)
            {
            CheckBox Check=new CheckBox();
                Check=(CheckBox)item.FindControl("chk");
                if (Check.Checked==true)
                {
                dr=dt.NewRow();
                    dr[0]= item.Cells[0].Text;
                    dr[1]=item.Cells[1].Text;
                    dt.Rows.Add(dr);
                }

            }
            Session["details"]=dt;
            Response.Redirect("displayitems.aspx");
        }
    }
}


displayitems.aspx:-
-----------------------

private void Page_Load(object sender, System.EventArgs e)
        {
            // Put user code to initialize the page here
            if(!Page.IsPostBack)
            {

                DataTable dt1=new DataTable();
                dt1=(DataTable)Session["details"];
                DataGrid1.DataSource=dt1.DefaultView;
                DataGrid1.DataBind();

            }


        }





Similar Threads
Thread Thread Starter Forum Replies Last Post
3 combo boxes ttkt Beginning PHP 0 July 2nd, 2005 02:20 PM
Using check boxes in datagrid ractim ADO.NET 2 September 8th, 2004 08:28 AM
SQL , List Boxes/Menu Boxes, DB's Ginzu3 Classic ASP Databases 1 June 30th, 2003 04:07 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.