Tutorials
Resources
Forum
Communities
Interview
Jobs
Projects
Offshore Development
Silverlight Tutorials
|
Mentor
|
Code Converter
|
Articles
|
Code Factory
|
Computer Jokes
|
Members
|
Peer Appraisal
|
IT Companies
|
Bookmarks
|
Revenue Sharing
|
Prizes & Awards
My Profile
Sign In
Register
AdSense Revenue
Active Members
Today
Abhi
(65)
Appukuttan
(40)
raj krishna
(37)
Last 7 Days
Appukuttan
(660)
Babu Akkandi
(465)
Tejinder Singh ...
(273)
more...
New Feature:
Community Sites
:
Create your own .NET community website and start earning from Google AdSense !
It's Free !
Recheck checkboxes in Asp.net Gridview
Posted Date: 30 Jun 2008
Resource Type:
Code Snippets
Category:
ASP.NET GridView
Author:
Ashokkumar
Member Level:
Silver
Rating:
Points
: 7
//Namespace Reference
using System.Collections;
///
/// method to repopulate selected items in the GridView
/// NOTE: This is so if the user pages back to page they've been
/// to the selected items on that page are still selected
///
private void RePopulateCheckedItems(GridView grid, string ctrl)
{
ArrayList checkedItems = new ArrayList();
string chkBoxIndex;
CheckBox chk;
checkedItems = (ArrayList)Session["CheckedItems"];
//make sure we have selected items
if (!(checkedItems == null))
{
//loop through each row in the GridView
foreach (GridViewRow row in grid.Rows)
{
//get the index of each row
chkBoxIndex = (string)grid.DataKeys[row.RowIndex].Value.ToString();
//check to see if that index is in our ArrayList
if (checkedItems.Contains(chkBoxIndex))
{
//find the CheckBox column since it's in the ArrayList
chk = (CheckBox)row.FindControl(ctrl);
//check the CheckBox
chk.Checked = true;
}
//results = (string[])checkedItems.ToArray(typeof(string));
////now create our delimited string
//chkdItems = string.Join(",", results);
}
}
}
Responses
No responses found. Be the first to respond and make money from
revenue sharing program
.
Feedbacks
Popular Tags
What are tags ?
Search Tags
Sign In
(No tags found.)
Post Feedback
This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must
Sign In
to post a response.
Next Resource:
paging, sorting, link button in GridView
Previous Resource:
How to make a Label to a runtime generated URL
Return to Discussion Resource Index
Post New Resource
Category:
ASP.NET GridView
Post resources and
earn money
!
Related Resources
Grid view with edit option with combo
Merging Grid View Header
Images in asp.net gridview
How to show images in GridView
Pass Multiple Query String using HyperLinkField in asp.net
dotNet Slackers
BizTalk Adaptors
Web Design
Contact Us
Privacy Policy
Terms Of Use