Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 2005 > C# 2005
|
C# 2005 For discussion of Visual C# 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 2005 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 August 3rd, 2008, 10:54 AM
Registered User
 
Join Date: May 2008
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Filter rows from checkbox

Hi EveryBody,

I have a problem, that i have been searching for it without any clue.

I hope i find it here.


This is what i want to make:

First:I have an asp page that contains a gridview, that retreive all the data from a sql table(via SQLDataSource).

Second:I have made a check box feild.(The value of the checkbox is the ID of the table).

Third:I have a button, when i click this button, it takes the value of the ID(if the checkbox is checked) and put this value in a strng variable.
The value of the variable will be something like that:
"1 2 4 6 8".

here is the code to do that:
string Array="";
        for(int i=0;i<GridView1.Rows.Count;i++)
        {

            GridView1.SelectedIndex=i;
            CheckBox cb_seleceted = (CheckBox)GridView1.SelectedRow.FindControl("Check Box1");
            if (cb_seleceted.Checked == true)
            {

                Array += GridView1.SelectedDataKey.Value.ToString() + " ";
            }
        }
        Array += "-1500";

        Session["ID_Array"] = Array;
        Response.Redirect("Default2.aspx");

The question is:
in another page, i need to select the sql table again,filtered by these IDs(that are in the string variable).

How can this be done?

Ramy Amr





Similar Threads
Thread Thread Starter Forum Replies Last Post
can I filter rows based on this type of constraint callagga SQL Language 2 August 21st, 2008 04:31 PM
Select Rows From A datagrid without a checkbox nkrust ASP.NET 2.0 Basics 0 January 10th, 2007 01:34 AM
checkbox checked by default by html:checkbox sachin.tathod Struts 3 December 4th, 2006 03:41 PM
Limit rows returned and next rows minhpx General .NET 1 August 12th, 2004 06:25 AM





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