making checkboxlist checked comparing it with integer value

A

a developer

i want to make checkboxlixt check or unkchek on the basis of certain values
like 1,2,3 here my checkboxlist have values like 1,2,3, now i m storing
values (integer types like 1,2,3,4,5,6, etc. ) and coparing these values
with checkboxlist's values but getting error as ..........
Exception Details: System.NullReferenceException: Object reference not set
to an instance of an object.

Source Error:


Line 274: {
Line 275: string strValue=strArr;
Line 276: ckbxListSites.SelectedItem.Value=strValue;
Line 277: }
Line

.......................................................................................................................
my coding is
...............................................................................


...string strSiteCodes=Convert.ToString(ds.Tables[0].Rows[0]["Site"]);
string[] strArr=strSiteCodes.Split(',');
int j=strArr.Length;
for(int i=0;i<j;i++)
{
string strValue=strArr;
ckbxListSites.SelectedItem.Value=strValue;
}................................................plz suggest me
how can i make checkboxlist check
 
A

azam

Hello,
Check if this works.
/////////////////////
string strSiteCodes= ds.Tables[0].Rows[0]["Site"].toString();
string[] strArr=strSiteCodes.Split(',');
int j=strArr.Length;

for(int i=0;i<j;i++)
{
string strValue=strArr;
ckbxListSites.SelectedValue = strValue;
}
/////////////////////
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top